What's are the out argument uses?

torch. stack ( seq , dim=0 , out=None ) β†’ Tensor
here what 's the use cases of out arguments ?

It’s just an optional argument to store the output to.
E.g. if you already have the tensor initialized, you could pass it to the function:

out = torch.empty(2, 10)
# ...
torch.stack((torch.randn(10), torch.randn(10)), dim=0, out=out)
2 Likes