Pad tensor in H, W Remarks: TensorFlow uses "ceil(input_spatial_shape[i] / strides[i])" rather than explicit padding like Caffe, pyTorch does. Hence, we need to pad here beforehand. Args: x (tf.tensor): incoming tensor p (int, optional): padding for H, W
(x, p=3)
| 15 | |
| 16 | |
| 17 | def pad(x, p=3): |
| 18 | """Pad tensor in H, W |
| 19 | |
| 20 | Remarks: |
| 21 | TensorFlow uses "ceil(input_spatial_shape[i] / strides[i])" rather than explicit padding |
| 22 | like Caffe, pyTorch does. Hence, we need to pad here beforehand. |
| 23 | |
| 24 | Args: |
| 25 | x (tf.tensor): incoming tensor |
| 26 | p (int, optional): padding for H, W |
| 27 | |
| 28 | Returns: |
| 29 | tf.tensor: padded tensor |
| 30 | """ |
| 31 | return tf.pad(x, [[0, 0], [0, 0], [p, p], [p, p]]) |
| 32 | |
| 33 | |
| 34 | def channel_norm(x): |
no outgoing calls
no test coverage detected