66584dea87782aed5509e4269a9f015002e1f5c1,pytext/torchscript/module.py,PyTextEmbeddingModuleWithDense,forward,#PyTextEmbeddingModuleWithDense#,1232
Before Change
languages=squeeze_1d(None),
)
// call model
dense_feat = self.normalizer.normalize(dense_feat)
dense_tensor = torch.tensor(dense_feat, dtype=torch.float)
if self.tensorizer.device != "":
dense_tensor = dense_tensor.to(self.tensorizer.device)
sentence_embedding = self._forward(inputs, dense_tensor)
if self.concat_dense:
return torch.cat([sentence_embedding, dense_tensor], 1)
else:
return sentence_embedding
@torch.jit.script_method
After Change
result = self.forward_impl(texts[:max_batch], dense_feat[:max_batch])
if input_len > max_batch:
texts = texts[max_batch:]
dense_feat = dense_feat[max_batch:]
while len(texts) > 0:
result_extension = self.forward_impl(
texts[:max_batch], dense_feat[:max_batch]
)
// the result of forward is either a torch.Tensor or a List[Any]
if isinstance(result, torch.Tensor):
result = torch.cat([result, result_extension], dim=0)
else:
result.extend(result_extension)
texts = texts[max_batch:]
dense_feat = dense_feat[max_batch:]
return result
@torch.jit.script_method
def make_prediction(
self,
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: facebookresearch/pytext
Commit Name: 66584dea87782aed5509e4269a9f015002e1f5c1
Time: 2021-02-23
Author: mikekg@fb.com
File Name: pytext/torchscript/module.py
Class Name: PyTextEmbeddingModuleWithDense
Method Name: forward
Project Name: mariogeiger/se3cnn
Commit Name: f66d3c5ed7b7fa96424fd0d8214594042d9ba3ff
Time: 2019-07-09
Author: geiger.mario@gmail.com
File Name: se3cnn/SO3.py
Class Name:
Method Name: irr_repr
Project Name: dmlc/dgl
Commit Name: cf8a3fb30547d6e980ecd8182f64a51df8e55c62
Time: 2021-02-10
Author: expye@outlook.com
File Name: python/dgl/backend/pytorch/tensor.py
Class Name:
Method Name: pack_padded_tensor