bed4f2dd50ff54eb7629362c3d03a3b758e0745a,spotlight/layers.py,BloomEmbedding,forward,#BloomEmbedding#Any#,115
Before Change
batch_size = indices.size()[0]
compressed_indices = (indices
.unsqueeze(1)
.expand(batch_size, self.num_hash_functions))
masks = self._mask_tensor.expand(batch_size, self.num_hash_functions)
compressed_indices = compressed_indices.detach()
compressed_indices = Variable((compressed_indices.data * masks.data) %
self.compressed_num_embeddings)
return self.embeddings(compressed_indices).mean(1)
After Change
// 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)
embedding /= self.num_hash_functions
return embedding
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: maciejkula/spotlight
Commit Name: bed4f2dd50ff54eb7629362c3d03a3b758e0745a
Time: 2017-08-09
Author: maciej.kula@gmail.com
File Name: spotlight/layers.py
Class Name: BloomEmbedding
Method Name: forward
Project Name: uber/pyro
Commit Name: e173956c4dfc65137f2b8ff41460fa55f672e17a
Time: 2021-01-05
Author: fritz.obermeyer@gmail.com
File Name: pyro/contrib/forecast/util.py
Class Name:
Method Name: _reshape_batch_univariate_transform
Project Name: open-mmlab/mmdetection
Commit Name: a6236b789b8f4e2e66c8379199f40ecef9afce06
Time: 2020-04-21
Author: 40779233+ZwwWayne@users.noreply.github.com
File Name: mmdet/core/anchor/anchor_generator.py
Class Name: AnchorGenerator
Method Name: valid_flags