MCPcopy Create free account
hub / github.com/pytorch/pytorch / testRelu

Method testRelu

caffe2/python/gradient_check_test.py:176–187  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

174 ]
175
176 def testRelu(self):
177 for input_size in self.test_configs:
178 op = core.CreateOperator("Relu", ["X"], ["Y"])
179 X = np.random.rand(*input_size).astype(np.float32)
180 # go away from the origin point to avoid kink problems
181 X += 0.01 * np.sign(X)
182 X[X == 0] = 0.01
183 res = device_checker.CheckSimple(op, [X], [0])
184 self.assertTrue(res)
185 for checker in gradient_checkers:
186 res, grad, grad_estimated = checker.CheckSimple(op, [X], 0, [0])
187 self.assertTrue(res)
188
189
190class TestTanh(test_util.TestCase):

Callers

nothing calls this directly

Calls 4

astypeMethod · 0.80
randMethod · 0.45
signMethod · 0.45
CheckSimpleMethod · 0.45

Tested by

no test coverage detected