TensorDictBase.get_at#
- TensorDictBase.get_at(key, index)#
- TensorDictBase.get_at(key, index, default)
Get the value of a tensordict from the key key at the index idx.
- Parameters:
- Returns:
indexed tensor.
Examples
>>> import torch >>> from tensordict import TensorDict >>> td = TensorDict({"x": torch.arange(3)}, batch_size=[]) >>> td.get_at("x", index=1) tensor(1)
Every tensordict class and every tensorclass has this method. For the other methods, see Methods by task.