PyTorch torch.set_printoptions Function
PyTorch torch Reference Manual
torch.set_printoptionsIt is a function in PyTorch used to set tensor printing options.
Function Definition
torch.set_printoptions(precision, threshold, edgeitems, linewidth, profile, sci_mode)
Usage Example
Example
import torch
# Set print precision to 2 decimal places
torch.set_printoptions(precision=2)
x = torch.randn(3, 3)
print(x)
# Set print precision to 2 decimal places
torch.set_printoptions(precision=2)
x = torch.randn(3, 3)
print(x)
Other Extensions