Method: Chainer::Functions::Pooling::AveragePooling2D.average_pooling_2d

Defined in:
lib/chainer/functions/pooling/average_pooling_2d.rb

.average_pooling_2d(x, ksize, stride: nil, pad: 0) ⇒ Chainer::Variable

Spatial average pooling function.

This function acts similarly to :class:‘Convolution2D`, but it computes the average of input spatial patch for each channel without any parameter instead of computing the inner products.

Parameters:

  • x (Chainer::Variable)

    Input variable.

  • ksize (integer)

    Size of pooling window. ‘ksize=k` and `ksize=[k, k]` are equivalent.

  • stride (integer) (defaults to: nil)

    Stride of pooling applications. ‘stride=s` and `stride=[s, s]` are equivalent. If `nil` is specified, then it uses same stride as the pooling window size.

  • pad (integer) (defaults to: 0)

    Spatial padding width for the input array. ‘pad=p` and `pad=[p, p]` are equivalent.

Returns:



18
19
20
# File 'lib/chainer/functions/pooling/average_pooling_2d.rb', line 18

def self.average_pooling_2d(x, ksize, stride: nil, pad: 0)
  self.new(ksize, stride: stride, pad: pad, cover_all: false).apply([x])[0]
end