Thank you for your reply!!! torch.stack solved my problem!
do you think its faster to append tensors to a list and then convert the list to a tensor using torch.stack or should I just work with tensors only and use torch.cat
for others
the main issue I was facing was that I had a list of tensors (batch_log_probs), each with a grad function. the grad function would disappear when I would convert the list to a tensor.
torch.stack() preserves the grad function