torch.nn.functional.normalize#
- torch.nn.functional.normalize(input,p=2.0,dim=1,eps=1e-12,out=None)[source]#
Perform normalization of inputs over specified dimension.
For a tensor
inputof sizes, each -element vector along dimensiondimis transformed asWith the default arguments it uses the Euclidean norm over vectors along dimension for normalization.
- Parameters
input (Tensor) – input tensor of any shape
p (float) – the exponent value in the norm formulation. Default: 2
dim (int ortuple ofints) – the dimension to reduce. Default: 1
eps (float) – small value to avoid division by zero. Default: 1e-12
out (Tensor,optional) – the output tensor. If
outis used, thisoperation won’t be differentiable.
- Return type