5a9c6aa03ea55ad85601c0c33ff762d6a2e2c7fa,torch_geometric/nn/models/node2vec.py,Node2Vec,loss,#Node2Vec#Any#Any#,86
Before Change
// Negative sampling loss.
num_negative_samples = self.num_negative_samples
if num_negative_samples is None:
num_negative_samples = rest.size(1)
neg_sample = torch.randint(self.num_nodes,
(walk.size(0), num_negative_samples),
dtype=torch.long, device=edge_index.device)
h_neg_rest = self.embedding(neg_sample)
out = (h_start * h_neg_rest).sum(dim=-1).view(-1)
neg_loss = -torch.log(1 - torch.sigmoid(out) + EPS).mean()
After Change
h_start = self.embedding(start).view(neg_rw.size(0), 1,
self.embedding_dim)
h_rest = self.embedding(rest.view(-1)).view(neg_rw.size(0), -1,
self.embedding_dim)
out = (h_start * h_rest).sum(dim=-1).view(-1)
neg_loss = -torch.log(1 - torch.sigmoid(out) + EPS).mean()
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 6
Instances
Project Name: rusty1s/pytorch_geometric
Commit Name: 5a9c6aa03ea55ad85601c0c33ff762d6a2e2c7fa
Time: 2020-05-23
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/nn/models/node2vec.py
Class Name: Node2Vec
Method Name: loss
Project Name: cornellius-gp/gpytorch
Commit Name: a7a12d157766b69cf4b1ddbb5fcdacfe485dc6fa
Time: 2019-04-03
Author: gpleiss@gmail.com
File Name: gpytorch/kernels/grid_interpolation_kernel.py
Class Name: GridInterpolationKernel
Method Name: _compute_grid
Project Name: rusty1s/pytorch_geometric
Commit Name: d02077d0a68fbd4d388ea9afbbbcbccb4af78433
Time: 2017-11-08
Author: matthias.fey@tu-dortmund.de
File Name: examples/mnist_superpixel_75.py
Class Name:
Method Name: train
Project Name: rusty1s/pytorch_geometric
Commit Name: d02077d0a68fbd4d388ea9afbbbcbccb4af78433
Time: 2017-11-08
Author: matthias.fey@tu-dortmund.de
File Name: examples/mnist_superpixel_75.py
Class Name:
Method Name: test