maxout

paddle.fluid.layers.nn. maxout ( x, groups, name=None, axis=1 ) [source]

Warning: API “paddle.fluid.layers.nn.maxout” is deprecated since 2.0.0, and will be removed in future versions. Please use “paddle.nn.functional.maxout” instead.

MaxOut Operator.

Assumed the input shape is (N, Ci, H, W). The output shape is (N, Co, H, W). Then $Co = Ci / groups$ and the operator formula is as follows:

:math:` y_{si+j} = max_{k} x_{gsi + sk + j} ` :math:` g = groups ` :math:` s = \frac{input.size}{num\_channels} ` :math:` 0 \le i < \frac{num\_channels}{groups} ` :math:` 0 \le j < s ` :math:` 0 \le k < groups `

Please refer to Paper: - Maxout Networks: http://www.jmlr.org/proceedings/papers/v28/goodfellow13.pdf - Multi-digit Number Recognition from Street View Imagery using Deep Convolutional Neural Networks: https://arxiv.org/pdf/1312.6082v4.pdf

Args:

x(Variable): A 4-D Tensor with data type of float32 or float64. The data format is NCHW or NHWC. Where N is batch size, C is the number of channels, H and W is the height and width of feature. groups(int): Specifies how many groups the input tensor will be split into at the channel dimension. And the number of output channel is the number of channels divided by groups. axis(int, optional): Specifies the index of channel dimension where maxout will be performed. It should be 1 when data format is NCHW, -1 or 3 when data format is NHWC. Default: 1. name(str, optional): For detailed information, please refer

System Message: ERROR/3 (/usr/local/lib/python3.8/site-packages/paddle/fluid/layers/nn.py:docstring of paddle.fluid.layers.nn.maxout, line 20)

Unexpected indentation.

to Name. Usually name is no need to set and None by default.

Returns:

Variable: A 4-D Tensor with same data type and data format with input Tensor.

Raises:

ValueError: If axis is not 1, -1 or 3. ValueError: If the number of input channels can not be divisible by groups.

Examples:
import paddle.fluid as fluid
import paddle
paddle.enable_static()

input = fluid.data(
    name='data',
    shape=[None, 256, 32, 32],
    dtype='float32')
out = fluid.layers.maxout(input, groups=2)