normalize

dragon.vm.torch.nn.functional.normalize(
  input,
  p=2,
  dim=1,
  end_dim=None,
  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 first dimension to reduce.
  • end_dim (int, optional) The last dimension to reduce.
  • eps (float, optional, default=1e-12) The value to \(\epsilon\).
  • out (dragon.vm.torch.Tensor, optional) The output tensor.
Returns:

dragon.vm.torch.Tensor The output tensor.