torch print full tensor

Solutions on MaxInterview for torch print full tensor by the best coders in the world

showing results for - "torch print full tensor"
Benjamín
23 Jun 2017
1torch.set_printoptions(profile="full")
2print(x) # prints the whole tensor
3torch.set_printoptions(profile="default") # reset
4print(x) # prints the truncated tensor
Neele
12 Jul 2019
1In [18]: torch.set_printoptions(edgeitems=1)
2
3In [19]: a
4Out[19]:
5tensor([[-0.7698,  ..., -0.1949],
6        ...,
7        [-0.7321,  ...,  0.8537]])
8
9In [20]: torch.set_printoptions(edgeitems=3)
10
11In [21]: a
12Out[21]:
13tensor([[-0.7698,  1.3383,  0.5649,  ...,  1.3567,  0.6896, -0.1949],
14        [-0.5761, -0.9789, -0.2058,  ..., -0.5843,  2.6311, -0.0008],
15        [ 1.3152,  1.8851, -0.9761,  ...,  0.8639, -0.6237,  0.5646],
16        ...,
17        [ 0.2851,  0.5504, -0.9471,  ...,  0.0688, -0.7777,  0.1661],
18        [ 2.9616, -0.8685, -1.5467,  ..., -1.4646,  1.1098, -1.0873],
19        [-0.7321,  0.7610,  0.3182,  ...,  2.5859, -0.9709,  0.8537]])