7c3d0a5ea7405fe74cc31f5553f7c04d9804d42e,pytorch/pytorchcv/models/isqrtcovresnet.py,Covpool,forward,#Any#Any#,21
Before Change
def forward(ctx, input):
x = input
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)
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)
return sigma
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: PavlosMelissinos/enet-keras
Commit Name: d529bddab06f83cbc3792acc18e18b57a74263f3
Time: 2017-05-15
Author: pmelissi@iti.gr
File Name: src/data/utils.py
Class Name:
Method Name: one_hot_to_rgb