group_norm(input, groups, epsilon=1e-05, param_attr=None, bias_attr=None, act=None, data_layout='NCHW', name=None)
Group Normalization Layer
Refer to Group Normalization .
input (Variable) – 4-D Tensor, the data type is float32 or float64.
groups (int) – The number of groups that divided from channels, the data type is int32.
epsilon (float, optional) – The small value added to the variance to prevent division by zero, the data type is float32. Default: 1e-05.
param_attr (ParamAttr|bool, optional) – ParamAttr object that specifies weight parameter attribute. If a bool type, only False is supported, which means there is no weight parameter. Default: None, the default weight parameter attribute is used. For more information, please refer to ParamAttr .
bias_attr (ParamAttr|bool, optional) – ParamAttr object that specifies bias parameter attribute. If a bool type, only False is supported, which means there is no bias parameter. Default: None, the default bias parameter attribute is used. For more information, please refer to ParamAttr .
act (str, optional) – Activation to be applied to the output of group normalizaiton.
data_layout (str, optional) – The data format of the input and output data. An optional string from: “NCHW”, “NHWC”. When it is “NCHW”, the data is stored in the order of: [batch_size, channels, height, width]. Default: “NCHW”.
name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name .
A 4-D Tensor has same data type and data format with input.
- Return type
ValueError– If data_layout is neither ‘NCHW’ nor ‘NHWC’.
import paddle.fluid as fluid data = fluid.data(name='data', shape=[None, 8, 32, 32], dtype='float32') x = fluid.layers.group_norm(input=data, groups=4)