Rate this Page
★ ★ ★ ★ ★

TensorDictBase.norm#

TensorDictBase.norm(*, out=None, dtype: dtype | None = None, key_transform: Callable[[NestedKey], NestedKey] | None = None) → Self#

Computes the norm of each tensor in the tensordict.

Keyword Arguments:
  • out (TensorDict, optional) – the output tensordict.

  • dtype (dtype, optional) – the output dtype.

  • key_transform (Callable[[NestedKey], NestedKey], optional) – A function to transform key names. If provided, all keys in the result will be transformed using this function. For string keys, the function receives a string. For tuple keys, it receives a tuple. Default: None.

Every tensordict class and every tensorclass has this method. For the other methods, see Methods by task.