dad75ba3efc4fb3e244288f99ed09d1d125c49cf,baseline/pytorch/embeddings.py,,_mean_pool,#Any#Any#,211
Before Change
def _mean_pool(_, embeddings):
return torch.mean(embeddings, 1, False)
def _max_pool(_, embeddings):
return torch.max(embeddings, 1, False)[0]
After Change
def _mean_pool(inputs, embeddings):
mask = (inputs != 0)
seq_lengths = mask.sum(1).float()
embeddings = embeddings.masked_fill(mask.unsqueeze(-1) == False, 0.)
return embeddings.sum(1)/seq_lengths.unsqueeze(-1)
def _max_pool(inputs, embeddings):
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 3
Instances
Project Name: dpressel/mead-baseline
Commit Name: dad75ba3efc4fb3e244288f99ed09d1d125c49cf
Time: 2020-05-01
Author: wliu@interactions.com
File Name: baseline/pytorch/embeddings.py
Class Name:
Method Name: _mean_pool
Project Name: ikostrikov/pytorch-ddpg-naf
Commit Name: 05ad358bb0c23dd42620dff54134bed29980ee25
Time: 2017-12-10
Author: pranjal.tandon@gmail.com
File Name: naf.py
Class Name: NAF
Method Name: update_parameters
Project Name: dpressel/mead-baseline
Commit Name: 14999aad8d52b516993a77538641590d46b976d8
Time: 2019-10-15
Author: blester125@users.noreply.github.com
File Name: python/addons/embed_bert_pytorch.py
Class Name: BERTEmbeddings
Method Name: get_output
Project Name: AIRLab-POLIMI/mushroom
Commit Name: 9ddaacb9e73ac061c08403e16ac1a4d5364dca9b
Time: 2021-02-10
Author: carlo.deramo@gmail.com
File Name: mushroom_rl/algorithms/value/dqn/rainbow.py
Class Name: RainbowNetwork
Method Name: forward