PyTorch torch.set_printoptions 関数
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)
# プリント精度を小数第2位に設定
torch.set_printoptions(precision=2)
x = torch.randn(3, 3)
print(x)
その他の拡張
Pytorch torch リファレンスマニュアル