Convert tensor data type from uint8 to float, divide value by 255.0 and permute the dimensions of clip tensor Args: clip (torch.tensor, dtype=torch.uint8): Size is (T, C, H, W) Return: clip (torch.tensor, dtype=torch.float): Size is (T, C, H, W)
(clip)
| 146 | |
| 147 | |
| 148 | def to_tensor(clip): |
| 149 | """ |
| 150 | Convert tensor data type from uint8 to float, divide value by 255.0 and |
| 151 | permute the dimensions of clip tensor |
| 152 | Args: |
| 153 | clip (torch.tensor, dtype=torch.uint8): Size is (T, C, H, W) |
| 154 | Return: |
| 155 | clip (torch.tensor, dtype=torch.float): Size is (T, C, H, W) |
| 156 | """ |
| 157 | _is_tensor_video_clip(clip) |
| 158 | if not clip.dtype == torch.uint8: |
| 159 | raise TypeError( |
| 160 | "clip tensor should have data type uint8. Got %s" % str(clip.dtype) |
| 161 | ) |
| 162 | # return clip.float().permute(3, 0, 1, 2) / 255.0 |
| 163 | return clip.float() / 255.0 |
| 164 | |
| 165 | |
| 166 | def normalize(clip, mean, std, inplace=False): |
no test coverage detected