06a07d00d11fb103a079a9adb0de4c3865a7f69e,spotlight/layers.py,BloomEmbedding,forward,#BloomEmbedding#Any#,138
Before Change
// The iterative solution is necessitated by making
// the implementation compatible with sequence-based models,
// where the embedding indices are already two-dimensional.
embedding = self.embeddings(indices * self._masks[0] % self.compressed_num_embeddings)
for mask in self._masks[1:]:
embedding += self.embeddings(indices * mask % self.compressed_num_embeddings)
After Change
masked_indices.remainder_(self.compressed_num_embeddings)
masked_indices = Variable(masked_indices)
if masked_indices.dim() == 2:
embedding = self.embeddings(masked_indices).mean(1)
else:
embedding = self.embeddings(masked_indices[:, :, 0])
for idx in range(1, len(self._masks)):
embedding += self.embeddings(masked_indices[:, :, idx])
embedding /= len(self._masks)
return embedding
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 6
Instances Project Name: maciejkula/spotlight
Commit Name: 06a07d00d11fb103a079a9adb0de4c3865a7f69e
Time: 2017-08-19
Author: maciej.kula@gmail.com
File Name: spotlight/layers.py
Class Name: BloomEmbedding
Method Name: forward
Project Name: facebookresearch/ParlAI
Commit Name: 72e28f315e6458993407beb4d7041ccebca90735
Time: 2018-10-16
Author: bhancock@fb.com
File Name: parlai/core/torch_ranker_agent.py
Class Name: TorchRankerAgent
Method Name: eval_step
Project Name: ikostrikov/pytorch-a2c-ppo-acktr
Commit Name: 4586366c1018257dd448d62f1fc7534e3f5a4338
Time: 2017-11-23
Author: ikostrikov@gmail.com
File Name: enjoy.py
Class Name:
Method Name:
Project Name: facebookresearch/ParlAI
Commit Name: 72e28f315e6458993407beb4d7041ccebca90735
Time: 2018-10-16
Author: bhancock@fb.com
File Name: parlai/core/torch_ranker_agent.py
Class Name: TorchRankerAgent
Method Name: train_step