|
|
@ -6,17 +6,15 @@ from op_test import OpTest
|
|
|
|
class TestRelu(OpTest):
|
|
|
|
class TestRelu(OpTest):
|
|
|
|
def setUp(self):
|
|
|
|
def setUp(self):
|
|
|
|
self.op_type = "relu"
|
|
|
|
self.op_type = "relu"
|
|
|
|
self.inputs = {
|
|
|
|
self.inputs = {'X': np.random.uniform(-1, 1, [4, 4]).astype("float32")}
|
|
|
|
'X': np.random.uniform(-1, 1, [11, 17]).astype("float32")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
self.outputs = {'Y': np.maximum(self.inputs['X'], 0)}
|
|
|
|
self.outputs = {'Y': np.maximum(self.inputs['X'], 0)}
|
|
|
|
|
|
|
|
|
|
|
|
def test_check_output(self):
|
|
|
|
def test_check_output(self):
|
|
|
|
self.check_output()
|
|
|
|
self.check_output()
|
|
|
|
|
|
|
|
|
|
|
|
def test_check_grad(self):
|
|
|
|
def test_check_grad(self):
|
|
|
|
self.check_grad(["X"], "Y", max_relative_error=0.007)
|
|
|
|
self.check_grad(['X'], 'Y', max_relative_error=0.007)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == "__main__":
|
|
|
|
unittest.main()
|
|
|
|
unittest.main()
|
|
|
|