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

Method testAbs

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

Source from the content-addressed store, hash-verified

219 ]
220
221 def testAbs(self):
222 for input_size in self.test_configs:
223 op = core.CreateOperator("Abs", ["X"], ["Y"])
224 X = np.random.rand(*input_size).astype(np.float32)
225 # go away from the origin point to avoid kink problems
226 X += 0.01 * np.sign(X)
227 X[X == 0] = 0.01
228 res = device_checker.CheckSimple(op, [X], [0])
229 self.assertTrue(res)
230 for checker in gradient_checkers:
231 res, grad, grad_estimated = checker.CheckSimple(op, [X], 0, [0])
232 self.assertTrue(res)
233
234class TestExp(test_util.TestCase):
235

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