8acacf7ecdddd031366f2c044bdc6ce5ba8e5a62,art/classifiers/mxnet.py,MXTextClassifier,predict_from_embedding,#MXTextClassifier#Any#Any#Any#,344
Before Change
preds = np.zeros((x_emb.shape[0], self.nb_classes), dtype=np.float32)
for b in range(int(np.ceil(x_emb.shape[0] / float(batch_size)))):
begin, end = b * batch_size, min((b + 1) * batch_size, x_emb.shape[0])
preds[begin:end] = self._preds_from_embedding([x_emb[begin:end]])[0]
if not logits:
exp = np.exp(preds[begin:end] - np.max(preds[begin:end], axis=1, keepdims=True))
preds[begin:end] = exp / np.sum(exp, axis=1, keepdims=True)
After Change
if logits is False:
preds = preds.softmax()
results[begin:end] = preds.asnumpy()
return results
def to_embedding(self, x):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 8acacf7ecdddd031366f2c044bdc6ce5ba8e5a62
Time: 2018-10-04
Author: Maria-Irina.Nicolae@ibm.com
File Name: art/classifiers/mxnet.py
Class Name: MXTextClassifier
Method Name: predict_from_embedding
Project Name: mahyarnajibi/SNIPER
Commit Name: 72caa3677f5f9cc09ed98324c76454c38a7e8098
Time: 2018-06-04
Author: mahyarnajibi@gmail.com
File Name: lib/metric.py
Class Name: MaskLogLossMetric
Method Name: update
Project Name: dmlc/dgl
Commit Name: f370e628cdf6dcff6f32392a35e1789be68630a8
Time: 2019-02-19
Author: zhengda1936@gmail.com
File Name: tests/compute/test_sampler.py
Class Name:
Method Name: verify_subgraph