avg_pool1d

dragon.vm.tensorflow.nn.avg_pool1d(
  input,
  ksize,
  strides,
  padding='VALID',
  data_format='NHWC',
  name=None
)[source]

Apply the 1d average pooling.

  • If data_format is 'NCHW', excepts input shape \((N, C, H)\), and output shape is \((N, C, H_{\text{out}})\).
  • If data_format is 'NHWC', excepts input shape \((N, H, C)\), and output shape is \((N, H_{\text{out}}, C)\).
  • padding could be 'VALID', 'SAME' or explicit padding size.

Examples:

x = tf.ones((1, 2, 2))
y = tf.nn.avg_pool1d(x, ksize=2, strides=2)
assert y.shape == (1, 1, 2)
Parameters:
  • input (dragon.Tensor) – The input tensor.
  • ksize (Union[int, Sequence[int]]) – The size of pooling window.
  • strides (Union[int, Sequence[int]]) – The stride of pooling window.
  • padding (Union[int, Sequence[int], str], optional, default='VALID') – The padding algorithm or size.
  • data_format (str, optional, default='NHWC') – 'NCHW' or 'NHWC'.
  • name (str, optional) – The operation name.
Returns:

dragon.Tensor – The output tensor.