shifted_conv2d¶
-
tfsnippet.layers.
shifted_conv2d
(*args, **kwargs)¶ 2D convolution with shifted input.
This method first pads input according to the kernel_size and spatial_shift arguments, then do 2D convolution (using conv_fn) with “VALID” padding.
Parameters: - input (Tensor) – The input tensor, at least 4-d.
- out_channels (int) – The channel numbers of the output.
- kernel_size (int or (int, int)) – Kernel size over spatial dimensions.
- spatial_shift –
The spatial_shift should be a tuple with two elements (corresponding to height and width spatial axes), and the elements can only be -1, 0 or 1.
If the shift for a specific axis is -1, then kernel_size - 1 zeros will be padded at the end of that axis. If the shift is 0, then (kernel_size - 1) // 2 zeros will be padded at the front, and kernel_size // 2 zeros will be padded at the end that axis. Otherwise if the shift is 1, then kernel_size + 1 zeros will be padded at the front of that axis.
- strides (int or (int, int)) – Strides over spatial dimensions.
- channels_last (bool) – Whether or not the channel axis is the last axis in input? (i.e., the data format is “NHWC”)
- conv_fn – The 2D convolution function. (default
conv2d()
) - name (str) – Default name of the variable scope. Will be uniquified. If not specified, generate one according to the class name.
- scope (str) – The name of the variable scope.
- **kwargs – Other named parameters passed to conv_fn.
Returns: The output tensor.
Return type: tf.Tensor