instance_norm

paddle.nn.functional. instance_norm ( x, running_mean=None, running_var=None, weight=None, bias=None, use_input_stats=True, momentum=0.9, eps=1e-05, data_format='NCHW', name=None ) [source]

See more detail in nn.layer.InstanceNorm2D.

Parameters
  • x (Tensor) – Input Tensor. It’s data type should be float32, float64.

  • running_mean (Tensor) – running mean. Default None.

  • running_var (Tensor) – running variance. Default None.

  • weight (Tensor, optional) – The weight tensor of instance_norm. Default: None.

  • bias (Tensor, optional) – The bias tensor of instance_norm. Default: None.

  • eps (float, optional) – A value added to the denominator for numerical stability. Default is 1e-5.

  • momentum (float, optional) – The value used for the moving_mean and moving_var computation. Default: 0.9.

  • use_input_stats (bool) – Default True.

  • data_format (str, optional) – Specify the input data format, may be “NC”, “NCL”, “NCHW” or “NCDHW”. Defalut “NCHW”.

  • name (str, optional) – Name for the InstanceNorm, default is None. For more information, please refer to Name..

Returns

None.

Examples

import paddle
import numpy as np

np.random.seed(123)
x_data = np.random.random(size=(2, 2, 2, 3)).astype('float32')
x = paddle.to_tensor(x_data)
instance_norm_out = paddle.nn.functional.instance_norm(x)

print(instance_norm_out)