Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.set_printoptions function

PyTorch torch.set_printoptions function


PyTorch torch reference manual PyTorch torch reference manual

torch.set_printoptions is a function in PyTorch used to set tensor printing options.

Function definition

torch.set_printoptions(precision, threshold, edgeitems, linewidth, profile, sci_mode)


Usage examples

Example

import

torch

Set the printing precision to 2 decimal places

torch.

set_printoptions

(

precision

=

2

)

x

=

torch.

randn

(

3

,

3

)

print

(

x

)


PyTorch torch reference manual PyTorch torch reference manual