def test_tanh(self): from keras.activations import tanh as t test_values = get_standard_values() x = K.placeholder(ndim=2) exp = t(x) f = K.function([x], [exp]) result = f([test_values])[0] expected = np.tanh(test_values) assert_allclose(result, expected, rtol=1e-05)
def test_tanh(): from keras.activations import tanh as t test_values = get_standard_values() x = T.vector() exp = t(x) f = theano.function([x], exp) result = f(test_values) expected = [math.tanh(v) for v in test_values] print(result) print(expected) list_assert_equal(result, expected)