TensorList
- class deepinv.utils.TensorList(x)[source]
Bases:
object
Represents a list of
torch.Tensor
with different shapes. It allows to sum, flatten, append, etc. lists of tensors seamlessly, in a similar fashion totorch.Tensor
.- Parameters:
x – a list of
torch.Tensor
, a singletorch.Tensor
or a TensorList.
- append(other)[source]
Appends a
torch.Tensor
or a list oftorch.Tensor
to the list.
- flatten()[source]
Returns a
torch.Tensor
with a flattened version of the list of tensors.
Examples using TensorList
:
Stacking and concatenating forward operators.
Stacking and concatenating forward operators.