PyTorch torch.set_printoptions 関数


Pytorch torch 参考手册Pytorch torch リファレンスマニュアル

torch.set_printoptionsPyTorch でテンソルのプリントオプションを設定する関数です。

関数定義

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

使用例

例

import torch

# プリント精度を小数第2位に設定
torch.set_printoptions(precision=2)

x = torch.randn(3, 3)
print(x)

Pytorch torch 参考手册Pytorch torch リファレンスマニュアル

その他の拡張