zamba.pytorch.transforms¶
ConvertHWCtoCHW
¶
Bases: Module
Convert tensor from (0:H, 1:W, 2:C) to (2:C, 0:H, 1:W)
Source code in zamba/pytorch/transforms.py
30 31 32 33 34 |
|
ConvertTCHWtoCTHW
¶
Bases: Module
Convert tensor from (T, C, H, W) to (C, T, H, W)
Source code in zamba/pytorch/transforms.py
23 24 25 26 27 |
|
ConvertTHWCtoCTHW
¶
Bases: Module
Convert tensor from (0:T, 1:H, 2:W, 3:C) to (3:C, 0:T, 1:H, 2:W)
Source code in zamba/pytorch/transforms.py
9 10 11 12 13 |
|
ConvertTHWCtoTCHW
¶
Bases: Module
Convert tensor from (T, H, W, C) to (T, C, H, W)
Source code in zamba/pytorch/transforms.py
16 17 18 19 20 |
|
PackSlowFastPathways
¶
Bases: Module
Creates the slow and fast pathway inputs for the slowfast model.
Source code in zamba/pytorch/transforms.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
PadDimensions
¶
Bases: Module
Pads a tensor to ensure a fixed output dimension for a give axis.
Attributes:
Name | Type | Description |
---|---|---|
dimension_sizes |
A tuple of int or None the same length as the number of dimensions in the input tensor. If int, pad that dimension to at least that size. If None, do not pad. |
Source code in zamba/pytorch/transforms.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
compute_left_and_right_pad(original_size, padded_size)
staticmethod
¶
Computes left and right pad size.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
original_size |
(list, int)
|
The original tensor size |
required |
padded_size |
(list, int)
|
The desired tensor size |
required |
Returns:
Type | Description |
---|---|
Tuple[int, int]
|
Tuple[int]: Pad size for right and left. For odd padding size, the right = left + 1 |
Source code in zamba/pytorch/transforms.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|