Rate this Page
★ ★ ★ ★ ★

TensorDictBase.pow#

TensorDictBase.pow(other: TensorDictBase | Tensor, *, default: str | Tensor | TensorCollection | None = None) → Self#

Takes the power of each element in self with other and returns a tensor with the result.

other can be either a single float number, a Tensor or a TensorDict.

When other is a tensor, the shapes of input and other must be broadcastable.

Parameters:

other (float, tensor or tensordict) – the exponent value

Keyword Arguments:

default (Tensor or str, optional) – the value to use for an entry that only one of the two tensordicts has. If None (default), the two tensordicts must have the same keys, and a missing key raises KeyError. If "intersection", only the keys that both tensordicts have are computed, and the other keys are dropped. Any other value replaces the missing entries on both sides of the operation.

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