3
4

More than 3 years have passed since last update.

PyTorch Tensorをprintで要約表示させないようにする

Last updated at Posted at 2021-03-08

はじめに

PyTorchのTensorの中身をprintすると、いい感じに要約表示してくれるが、全部表示させたいときもある。
numpyで全部表示させる方法はググるとすぐでてくるが、PyTorchのTensorについてはすぐに見つからなかったのでメモっておく

方法

以下のようにset_printoptionsのidgeitemsを指定する。

torch.set_printoptions(edgeitems=1000)

これは最初と最後にようやく表示される配列の要素の数の設定であるが、これを大き目の値に設定しておけば、配列の要素をずらっと表示させることが可能だ。

set_printoptionsメソッドは他にも色々設定できるようなので、参考文献を見てほしい。

参考

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4