2d21747abdbf1968a9d565a4090d5d6297ade71a,encoding/functions/encoding.py,_scaledL2,forward,#Any#Any#Any#Any#,86

Before Change


    def forward(ctx, X, C, S):
        B, N, _ = X.size()
        K = C.size(0)
        with torch.cuda.device_of(X):
            SL = X.new(B, N, K)
        if isinstance(X, torch.cuda.FloatTensor):
            with torch.cuda.device_of(X):
                encoding_lib.Encoding_Float_scaledl2_forward(SL, X, C, S)
        elif isinstance(X, torch.cuda.DoubleTensor):
            with torch.cuda.device_of(X):
                encoding_lib.Encoding_Double_scaledl2_forward(SL, X, C, S)
        else:
            raise RuntimeError("Unimplemented data type!")
        ctx.save_for_backward(X, C, S, SL)
        return SL

    @staticmethod

After Change


class _scaledL2(Function):
    @staticmethod
    def forward(ctx, X, C, S):
        if X.is_cuda:
            SL = lib.gpu.scaled_l2_forward(X, C, S)
        else:
            raise NotImplemented
        ctx.save_for_backward(X, C, S, SL)
        return SL

    @staticmethod
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 26

Instances


Project Name: zhanghang1989/PyTorch-Encoding
Commit Name: 2d21747abdbf1968a9d565a4090d5d6297ade71a
Time: 2018-06-04
Author: zhang.hang@rutgers.edu
File Name: encoding/functions/encoding.py
Class Name: _scaledL2
Method Name: forward


Project Name: zhanghang1989/PyTorch-Encoding
Commit Name: 2d21747abdbf1968a9d565a4090d5d6297ade71a
Time: 2018-06-04
Author: zhang.hang@rutgers.edu
File Name: encoding/functions/encoding.py
Class Name: _aggregate
Method Name: forward


Project Name: zhanghang1989/PyTorch-Encoding
Commit Name: 2d21747abdbf1968a9d565a4090d5d6297ade71a
Time: 2018-06-04
Author: zhang.hang@rutgers.edu
File Name: encoding/functions/encoding.py
Class Name: _scaledL2
Method Name: forward


Project Name: zhanghang1989/PyTorch-Encoding
Commit Name: 2d21747abdbf1968a9d565a4090d5d6297ade71a
Time: 2018-06-04
Author: zhang.hang@rutgers.edu
File Name: encoding/functions/syncbn.py
Class Name: _sum_square
Method Name: forward