MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / pad

Function pad

examples/OpticalFlow/flownet_models.py:17–31  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

15
16
17def 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
34def channel_norm(x):

Callers 4

flownet2_fusionMethod · 0.85
flownet2_sdMethod · 0.85
graph_structureMethod · 0.85
graph_structureMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected