normalize

dragon.vm.torch.nn.functional.normalize(
  input,
  p=2,
  dim=1,
  eps=1e-12,
  out=None
)[source]

Apply the \(L_{p}\) normalization to the input.

The \(L_{p}\) normalization is defined as:

\[v = \frac{v}{\left\|v\right\|_{p} + \epsilon} \]
Parameters:
  • input (dragon.vm.torch.Tensor) – The input tensor.
  • p (int, optional, default=2) – The exponent of norm.
  • dim (int, optional, default=1) – The dimension to reduce.
  • eps (float, optional, default=1e-12) – The value to \(\epsilon\).
  • out (dragon.vm.torch.Tensor, optional) – The optional output tensor.
Returns:

dragon.vm.torch.Tensor – The output tensor.