add activation operator python test

update-doc-pybind
qijun 8 years ago
parent d736fc0e00
commit b50a507617

@ -61,9 +61,9 @@ struct ExpGrad {
const framework::Tensor& X, const framework::Tensor& Y,
const framework::Tensor& dY, framework::Tensor* dX) {
auto dx = framework::EigenVector<T>::Flatten(*dX);
auto dy = framework::EigenVector<T>::Flatten(dY);
auto y = framework::EigenVector<T>::Flatten(Y);
auto* place = device_context.template get_eigen_device<Place>();
dx.device(*place) = dy.exp();
dx.device(*place) = y;
}
};

@ -3,9 +3,9 @@ import numpy as np
from op_test import OpTest
class TestExp(OpTest):
class TestRelu(OpTest):
def setUp(self):
self.op_type = "exp"
self.op_type = "relu"
self.inputs = {
'X': np.random.uniform(-1, 1, [11, 17]).astype("float32")
}

Loading…
Cancel
Save