809d0e5b52561fefd3b0d98c08d3cbb175d7e706,onmt/modules/Util.py,LayerNorm,forward,#LayerNorm#Any#,35
Before Change
if z.size(1) == 1:
return z
mu = torch.mean(z, dim=1).unsqueeze(1)
sigma = torch.std(z, dim=1).unsqueeze(1)
ln_out = (z - mu.expand_as(z)) / (sigma.expand_as(z) + self.eps)
ln_out = ln_out * self.a_2.expand_as(ln_out) \
+ self.b_2.expand_as(ln_out)
return ln_out
After Change
mu = torch.mean(z, dim=1)
sigma = torch.std(z, dim=1)
// HACK. PyTorch is changing behavior
if mu.dim() == 1:
mu = mu.unsqueeze(1)
sigma = sigma.unsqueeze(1)
ln_out = (z - mu.expand_as(z)) / (sigma.expand_as(z) + self.eps)
ln_out = ln_out.mul(self.a_2.expand_as(ln_out)) \
+ self.b_2.expand_as(ln_out)
return ln_out
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: OpenNMT/OpenNMT-py
Commit Name: 809d0e5b52561fefd3b0d98c08d3cbb175d7e706
Time: 2017-07-04
Author: sasha.rush@gmail.com
File Name: onmt/modules/Util.py
Class Name: LayerNorm
Method Name: forward
Project Name: pytorch/fairseq
Commit Name: da9eaba12d82b9bfc1442f0e2c6fc1b895f4d35d
Time: 2021-02-18
Author: elizabeth.salesky@gmail.com
File Name: fairseq/data/audio/audio_utils.py
Class Name:
Method Name: _get_torchaudio_fbank
Project Name: facebookresearch/Horizon
Commit Name: 16ba3819bbfde4e49711b51ccd357cb92d1de386
Time: 2020-05-21
Author: kittipat@fb.com
File Name: reagent/gym/preprocessors/default_preprocessors.py
Class Name: RecsimObsPreprocessor
Method Name: __call__