981e912036e667a0d0e100a12001e3e8543620ea,pytorch/pytorchcv/models/sknet.py,SKConvBlock,forward,#SKConvBlock#Any#,70

Before Change



        outs = self.branches(x)

        u = reduce(lambda y1, y2: y1 + y2, outs)
        s = self.global_pool(u)
        z = self.fc1(s)
        w = self.fc2(z)
        w = w.reshape(batch, self.num_branches, self.out_channels, -1)
        w = self.softmax(w)

        w = list(w.chunk(self.num_branches, dim=1))
        w = list(map(lambda y: y.reshape(batch, self.out_channels, 1, 1), w))
        v = list(map(lambda y1, y2: y1 * y2, outs, w))
        v = reduce(lambda y1, y2: y1 + y2, v)
        return v

After Change


        w = w.unsqueeze(-1).unsqueeze(-1)

        y = y * w
        y = y.sum(dim=1)
        return y


class SKNetBottleneck(nn.Module):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: osmr/imgclsmob
Commit Name: 981e912036e667a0d0e100a12001e3e8543620ea
Time: 2019-04-07
Author: osemery@gmail.com
File Name: pytorch/pytorchcv/models/sknet.py
Class Name: SKConvBlock
Method Name: forward


Project Name: ruotianluo/ImageCaptioning.pytorch
Commit Name: 8831123d7c23bd6dbc05c8aa279a2a27ba5303e4
Time: 2020-01-10
Author: rluo@ttic.edu
File Name: models/CaptionModel.py
Class Name: CaptionModel
Method Name: beam_search