9bb40b524d8de503f6368e1229367edaca0330f5,batchflow/models/eager_torch/layers/resize.py,Combine,forward,#Combine#Any#,278

Before Change



    def forward(self, inputs):
        if self.op in self.CONCAT_OPS:
            inputs = self.resize(inputs)
            return torch.cat(inputs, dim=1)
        if self.op in self.SUM_OPS:
            inputs = self.resize(inputs)
            return torch.stack(inputs, dim=0).sum(dim=0)
        if self.op in self.MULTI_OPS:
            inputs = self.resize(inputs)
            result = 1
            for item in inputs:
                result = result*item
            return result
        if self.op in self.SOFTSUM_OPS:
            inputs = [conv(tensor) for conv, tensor in zip(self.conv, inputs)]
            return torch.stack(inputs, dim=0).sum(dim=0)
        raise ValueError("Combine operation must be in {}, instead got {}.".format(self.ALL_OPS, self.op))

    def extra_repr(self):

After Change


        if callable(self.op):
            return self.op(inputs)
        if self.op in self.OPS:
            return self.OPS[self.op](inputs)
        raise ValueError("Combine operation must be a callable or \
                          one from {}, instead got {}.".format(self.ALL_OPS, self.op))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: analysiscenter/batchflow
Commit Name: 9bb40b524d8de503f6368e1229367edaca0330f5
Time: 2019-11-22
Author: Tsimfer.SA@gazprom-neft.ru
File Name: batchflow/models/eager_torch/layers/resize.py
Class Name: Combine
Method Name: forward


Project Name: deepchem/deepchem
Commit Name: 97d7f88df32ae58875d7534c7c517905a3eb1341
Time: 2020-11-05
Author: mufeili1996@gmail.com
File Name: deepchem/models/torch_models/gat.py
Class Name: GAT
Method Name: forward


Project Name: deepchem/deepchem
Commit Name: f766c92a63fb67a99744dcb82c8c78406fbf905a
Time: 2020-11-04
Author: mufeili1996@gmail.com
File Name: deepchem/models/torch_models/gat.py
Class Name: GAT
Method Name: forward