0ad33d606682537466f3430fc6d6ac7d47460f1a,beginner_source/blitz/tensor_tutorial.py,,,#,29

Before Change


// let us run this cell only if CUDA is available
if torch.cuda.is_available():
    x = x.cuda()
    y = y.cuda()
    x + y

After Change


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Construct a matrix filled zeros and of dtype long:

x = torch.zeros(5, 3, dtype=torch.long)
print(x)

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Construct a tensor directly from data:

x = torch.tensor([5.5, 3])
print(x)

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// or create a tensor basing on existing tensor. These methods
// will reuse properties of the input tensor, e.g. dtype, unless
// new values are provided by user

x = x.new_ones(5, 3, dtype=torch.double)      // new_* methods take in sizes
print(x)

x = torch.randn_like(x, dtype=torch.float)    // override dtype!
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: pytorch/tutorials
Commit Name: 0ad33d606682537466f3430fc6d6ac7d47460f1a
Time: 2018-04-24
Author: soumith@gmail.com
File Name: beginner_source/blitz/tensor_tutorial.py
Class Name:
Method Name:


Project Name: pytorch/tutorials
Commit Name: 0ad33d606682537466f3430fc6d6ac7d47460f1a
Time: 2018-04-24
Author: soumith@gmail.com
File Name: beginner_source/blitz/tensor_tutorial.py
Class Name:
Method Name:


Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: cbcc3f315c653706ceded6ba42f222616322a3f2
Time: 2018-04-25
Author: max.lapan@gmail.com
File Name: ch03/03_atari_gan.py
Class Name:
Method Name:


Project Name: rusty1s/pytorch_geometric
Commit Name: b6a7c304c68fe4a1300970459a3807ee7bce6c87
Time: 2018-05-22
Author: matthias.fey@tu-dortmund.de
File Name: examples/cora.py
Class Name:
Method Name: