MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _check

Method _check

tensorflow/python/kernel_tests/einsum_op_test.py:38–51  ·  view source on GitHub ↗
(self, s, *input_shapes, **kwargs)

Source from the content-addressed store, hash-verified

36class EinsumOpTest(test.TestCase):
37
38 def _check(self, s, *input_shapes, **kwargs):
39 dtype = kwargs.pop('dtype', np.float32)
40 r = np.random.RandomState(0)
41 inputs = []
42 for shape in input_shapes:
43 arr = np.array(r.randn(*shape)).astype(dtype)
44 if dtype == np.complex64 or dtype == np.complex128:
45 arr += 1j * np.array(r.randn(*shape)).astype(dtype)
46 inputs.append(arr)
47 input_tensors = [constant_op.constant(x, shape=x.shape) for x in inputs]
48 a = np.einsum(s, *inputs)
49 with ops.device("/cpu:0"):
50 b = self.evaluate(gen_linalg_ops.einsum(input_tensors, s))
51 self.assertAllClose(a, b, atol=1e-4, rtol=1e-4)
52
53 def testUnary(self):
54 self._check('->', ())

Callers 5

testUnaryMethod · 0.95
testUnaryEllipsisMethod · 0.95
testBinaryMethod · 0.95
testBroadcastingMethod · 0.95
testDtypesMethod · 0.95

Calls 6

popMethod · 0.45
appendMethod · 0.45
constantMethod · 0.45
deviceMethod · 0.45
evaluateMethod · 0.45
assertAllCloseMethod · 0.45

Tested by

no test coverage detected