Append Tensor to Libtorch TensorList

How to append Torch::Tensor to Torch::TensorList?

1 Like

A TensorList is just an ArrayRef. As ArrayRef does not own the storage it is impossible to add a Tensor to the TensorList. Maybe create a vector of Tensors (owns the storage) and then create a new TensorList based on the vector?

1 Like