7c3d0a5ea7405fe74cc31f5553f7c04d9804d42e,pytorch/pytorchcv/models/isqrtcovresnet.py,Covpool,forward,#Any#Any#,21
Before Change
batch_size = x.data.shape[0]
channels = x.data.shape[1]
h = x.data.shape[2]
w = x.data.shape[3]
M = h * w
x = x.reshape(batch_size, channels, M)
I_hat = (-1. / M / M) * torch.ones(M, M, device=x.device) + (1. / M) * torch.eye(M, M, device=x.device)
I_hat = I_hat.view(1, M, M).repeat(batch_size, 1, 1).type(x.dtype)
y = x.bmm(I_hat).bmm(x.transpose(1, 2))
ctx.save_for_backward(input, I_hat)
After Change
batch, channels, height, width = x.size()
n = height * width
xn = x.reshape(batch, channels, n)
identity_bar = ((1.0 / n) * torch.eye(n, dtype=xn.dtype, device=xn.device)).unsqueeze(dim=0).repeat(batch, 1, 1)
ones_bar = torch.full((batch, n, n), fill_value=(-1.0 / n / n), dtype=xn.dtype, device=xn.device)
i_bar = identity_bar + ones_bar
sigma = xn.bmm(i_bar).bmm(xn.transpose(1, 2))
ctx.save_for_backward(x, i_bar)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances Project Name: osmr/imgclsmob
Commit Name: 7c3d0a5ea7405fe74cc31f5553f7c04d9804d42e
Time: 2019-03-02
Author: osemery@gmail.com
File Name: pytorch/pytorchcv/models/isqrtcovresnet.py
Class Name: Covpool
Method Name: forward
Project Name: facebookresearch/Horizon
Commit Name: 20c7dac379a56a69fc0a2fa56a2729eeced2c5ac
Time: 2020-04-22
Author: czxttkl@fb.com
File Name: reagent/models/seq2slate_reward.py
Class Name: Seq2SlateRewardNet
Method Name: _convert_seq2slate_to_reward_model_format
Project Name: cornellius-gp/gpytorch
Commit Name: 529456c17464022d42e1c343bec52f2d4d77e79b
Time: 2018-10-29
Author: balandat@fb.com
File Name: gpytorch/likelihoods/noise_models.py
Class Name: HomoskedasticNoise
Method Name: forward