cb1782b75f7c98f1411bdcb2818f3e2389ff2015,pytext/models/embeddings/pretrained_model_embedding.py,PretrainedModelEmbedding,forward,#PretrainedModelEmbedding#Any#,19
Before Change
f"Input embedding_dim {embedding.shape[1]} is not a"
+ f" multiple of specified embedding_dim {self.embedding_dim}"
)
num_tokens = embedding.shape[1] // self.embedding_dim
unflattened_embedding = embedding.view(-1, num_tokens, self.embedding_dim)
return unflattened_embedding
After Change
// Unflatten embedding Tensor from (batch_size, seq_len * embedding_size)
// to (batch_size, seq_len, embedding_size).
num_tokens = embedding_shape[1] // self.embedding_dim
new_embedding_shape = torch.cat(
(
torch.LongTensor([-1]),
num_tokens.view(1),
torch.LongTensor([self.embedding_dim]),
)
)
return torch.onnx.operators.reshape_from_tensor_shape(
embedding, new_embedding_shape
)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: facebookresearch/pytext
Commit Name: cb1782b75f7c98f1411bdcb2818f3e2389ff2015
Time: 2019-04-21
Author: kushall@fb.com
File Name: pytext/models/embeddings/pretrained_model_embedding.py
Class Name: PretrainedModelEmbedding
Method Name: forward
Project Name: arraiy/torchgeometry
Commit Name: dcd394f4a5bddb1fc97ae4a7224e00147fc110a3
Time: 2020-01-15
Author: diegovd0296@gmail.com
File Name: examples/data_augmentation.py
Class Name: DummyDataset
Method Name: __getitem__
Project Name: arraiy/torchgeometry
Commit Name: 73317ca61e33b42353fc4b3010f586124954ca18
Time: 2019-12-19
Author: diegovd0296@gmail.com
File Name: examples/data_augmentation.py
Class Name: DummyDataset
Method Name: __getitem__