Difference between saving a tensor via .pt and .pth

I have a tensor T=torch.rand(1,1000,10,10) and i want to save it and reuse it later.
I can do it via .pt and .pth
what is the difference between them?
also, is there any other way of saving a tensor that save more space/memory?

1 Like

You should use torch.save() to save tensors. There is a single serialization format and the file extension is irrelevant.

1 Like

sorry for confusion, i know i gotta use torch.save()

I meant i can do both torch.save(T, lablablab.pt) and torch.save(T, lablablab.pth)

They will do exactly the same thing. The saving format will not change depending on the file extension.

2 Likes