e15bc113b83c2bdf980d2557971888d10011ef29,neuralstyle/transformernet.py,InstanceNormalization,forward,#InstanceNormalization#,117

Before Change


        t = x.resize(x.size()[0], x.size()[1], 1, n)
        mean = torch.mean(t, 3).repeat(1, 1, x.size()[2], x.size()[3])
        // Calculate the biased var. torch.var returns unbiased var
        var = torch.var(t, 3).repeat(1, 1, x.size()[2], x.size()[3]) * ((n - 1) / float(n))
        res = (x - mean) / torch.sqrt(var + 1e-5)
        // TODO: Check if you need to add scaling and shifting here
        return res

After Change


        mean = torch.mean(t, 3).expand_as(x)
        // Calculate the biased var. torch.var returns unbiased var
        var = torch.var(t, 3).expand_as(x)
        scale_broadcast = self.scale.unsqueeze(1).unsqueeze(1).unsqueeze(0)
        scale_broadcast = scale_broadcast.expand_as(x)
        shift_broadcast = self.shift.unsqueeze(1).unsqueeze(1).unsqueeze(0)
        shift_broadcast = shift_broadcast.expand_as(x)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 2

Instances


Project Name: abhiskk/fast-neural-style
Commit Name: e15bc113b83c2bdf980d2557971888d10011ef29
Time: 2017-03-14
Author: abhishekkadiyan@gmail.com
File Name: neuralstyle/transformernet.py
Class Name: InstanceNormalization
Method Name: forward


Project Name: ncullen93/torchsample
Commit Name: 943753c968fe7c0cbafc6e44d60f1b28b42e997b
Time: 2017-05-03
Author: ncullen.th@dartmouth.edu
File Name: torchsample/utils.py
Class Name:
Method Name: th_affine2d


Project Name: eriklindernoren/PyTorch-YOLOv3
Commit Name: b591a7aecce5b8de42a0dd7bba62780675d34fce
Time: 2019-04-30
Author: eriklindernoren@live.se
File Name: utils/datasets.py
Class Name: ImageFolder
Method Name: __getitem__