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

Method testScalar2D

tensorflow/compiler/tests/gather_test.py:57–70  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

55 self.assertAllEqual(np_val, gather_val)
56
57 def testScalar2D(self):
58 with self.session() as session, self.test_scope():
59 data = np.array([[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11],
60 [12, 13, 14]])
61 for dtype in self.all_tf_types:
62 for axis in 0, 1, -1:
63 params_np = self._buildParams(data, dtype)
64 params = array_ops.placeholder(dtype=dtype)
65 indices = constant_op.constant(2)
66 gather_t = array_ops.gather(params, indices, axis=axis)
67 gather_val = session.run(gather_t, feed_dict={params: params_np})
68 expected = constant_op.constant(
69 np.take(params_np, 2, axis=axis), dtype)
70 self.assertAllEqual(expected, gather_val)
71
72 def testSimpleTwoD32(self):
73 with self.session() as session, self.test_scope():

Callers

nothing calls this directly

Calls 9

_buildParamsMethod · 0.95
sessionMethod · 0.45
test_scopeMethod · 0.45
placeholderMethod · 0.45
constantMethod · 0.45
gatherMethod · 0.45
runMethod · 0.45
takeMethod · 0.45
assertAllEqualMethod · 0.45

Tested by

no test coverage detected