Rate this Page
★ ★ ★ ★ ★

TensorDictBase.fill#

TensorDictBase.fill_(key: NestedKey, value: float | bool) → Self#

Fills a tensor pointed by the key with a given scalar value.

Parameters:
  • key (str or nested key) – entry to be filled.

  • value (Number or bool) – value to use for the filling.

Returns:

self

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