Append Tensors to a file

Inside my model, I am trying to dump each layer’s output into a file. One way for me is to convert the Tensor into numpy array and then use np.savetxt(). But is there any way to efficiently append tensors to a file.

Please check torch.save()