db9d883aecb6cdfba6c6bbc76b83d85397fef28d,maml_rl/utils/torch_utils.py,,weighted_normalize,#Any#Any#Any#Any#,29

Before Change


    return distribution

def weighted_normalize(tensor, dim=None, weights=None, epsilon=1e-8):
    if weights is None:
        weights = torch.ones_like(tensor)
    mean = weighted_mean(tensor, dim=dim, weights=weights)
    centered = tensor * weights - mean
    std = torch.sqrt(weighted_mean(centered ** 2, dim=dim, weights=weights))
    return centered / (std + epsilon)

After Change


    mean = weighted_mean(tensor, dim=dim, weights=weights)
    out = tensor * weights - mean
    std = torch.sqrt(weighted_mean(out ** 2, dim=dim, weights=weights))
    out.div_(std + epsilon)
    return out

def detach_distribution(pi):
    if isinstance(pi, Categorical):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: tristandeleu/pytorch-maml-rl
Commit Name: db9d883aecb6cdfba6c6bbc76b83d85397fef28d
Time: 2018-10-23
Author: tristan.deleu@gmail.com
File Name: maml_rl/utils/torch_utils.py
Class Name:
Method Name: weighted_normalize


Project Name: pytorch/fairseq
Commit Name: 8ce2c35d8e2dfb2b6dd220058710f81df5eb5729
Time: 2019-05-24
Author: yqw@fb.com
File Name: scripts/average_checkpoints.py
Class Name:
Method Name: average_checkpoints