How to print the full contents of a PyTorch tensor

 refer to code:


import torch

# create a tensor
x = torch.randn(3, 4)

# set print options to display full tensor
torch.set_printoptions(precision=10, threshold=None, edgeitems=None, linewidth=None, profile=None)

# print the full tensor


In this example, we set the precision to 10 to display up to 10 decimal places, and set threshold, edgeitems, linewidth, and profile to None to display all the elements of the tensor. You can adjust these settings to your preference, depending on the size and precision of your tensor.

Thank you. 

No comments:

Post a Comment