PyTorch torch.set_printoptions Function


Pytorch torch 参考手册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)

Pytorch torch 参考手册PyTorch torch Reference Manual

Other Extensions