8e84bd1c5a4cd0e61ee67abc532ab692e5335914,src/gluonnlp/attention_cell.py,,masked_softmax,#Any#Any#Any#Any#,248
Before Change
except ImportError:
pass
att_score = np.where(mask, att_score, neg)
logits = npx.softmax(att_score, axis=axis) * mask
else:
logits = npx.softmax(att_score, axis=axis)
return logits
// TODO(sxjscience) Directly implement a kernel for masked logsoftmax
def masked_logsoftmax(att_score, mask, dtype=np.float32, axis: int = -1):
After Change
Shape (..., length, ...)
if mask is None:
return npx.softmax(att_score, axis=axis, temperature=temperature)
else:
return npx.masked_softmax(att_score, mask=mask.astype(np.bool),
axis=axis, temperature=temperature)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: dmlc/gluon-nlp
Commit Name: 8e84bd1c5a4cd0e61ee67abc532ab692e5335914
Time: 2020-12-10
Author: xshiab@connect.ust.hk
File Name: src/gluonnlp/attention_cell.py
Class Name:
Method Name: masked_softmax
Project Name: keras-team/keras
Commit Name: 7c84229f350b83ce397b8c65e52e333e99b6d19d
Time: 2019-03-04
Author: francois.chollet@gmail.com
File Name: keras/backend/tensorflow_backend.py
Class Name:
Method Name: random_binomial
Project Name: tflearn/tflearn
Commit Name: fa93b40058f9bfe5a89217d52bb7303d39e770d1
Time: 2018-10-16
Author: aymeric.damien@gmail.com
File Name: tflearn/activations.py
Class Name:
Method Name: selu