depthwise_conv2d¶
dragon.vm.tensorflow.nn.
depthwise_conv2d
(
input,
filters,
strides=1,
padding='VALID',
data_format='NHWC',
dilations=1,
name=None
)[source]¶Apply the 2d depthwise convolution. [Chollet, 2016].
- If
data_format
is'NCHW'
, excepts input shape \((N, C_{\text{in}}, H, W)\), filters shape \((C_{\text{out}}, 1, H_{\text{f}}, W_{\text{f}})\), and output shape is \((N, C_{\text{out}}, H_{\text{out}}, W_{\text{out}})\). - If
data_format
is'NHWC'
, excepts input shape \((N, H, W, C_{\text{in}})\), filters shape \((C_{\text{out}}, H_{\text{f}}, W_{\text{f}}, 1)\), and output shape is \((N, H_{\text{out}}, W_{\text{out}}, C_{\text{out}})\). padding
could be'VALID'
,'SAME'
or explicit padding size.
x = tf.ones((1, 2, 2, 2)) filters = tf.ones((2, 1, 1, 1)) y = tf.nn.depthwise_conv2d(x, filters) assert y.shape == (1, 2, 2, 2)
- Parameters:
- input (dragon.Tensor) – The input tensor.
- filters (dragon.Tensor) – The filters tensor.
- strides (Union[int, Sequence[int]]) – The stride of convolution window.
- padding (Union[int, Sequence[int], str]) – The padding algorithm or size.
- data_format (str, optional, default='NHWC') –
'NCHW'
or'NHWC'
. - dilations (Union[int, Sequence[int]], optional, default=1) – The rate of dilated filters.
- name (str, optional) – The operation name.
- Returns:
dragon.Tensor – The output tensor.
- If