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

Method testSimpleTwoD32

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

Source from the content-addressed store, hash-verified

70 self.assertAllEqual(expected, gather_val)
71
72 def testSimpleTwoD32(self):
73 with self.session() as session, self.test_scope():
74 data = np.array([[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11],
75 [12, 13, 14]])
76 for dtype in self.all_tf_types:
77 for axis in 0, 1, -1:
78 params_np = self._buildParams(data, dtype)
79 params = array_ops.placeholder(dtype=dtype)
80 # The indices must be in bounds for any axis.
81 indices = constant_op.constant([0, 1, 0, 2])
82 gather_t = array_ops.gather(params, indices, axis=axis)
83 gather_val = session.run(gather_t, feed_dict={params: params_np})
84 expected = constant_op.constant(
85 np.take(params_np, [0, 1, 0, 2], axis=axis), dtype)
86 self.assertAllEqual(expected, gather_val)
87
88 def testSimpleTwoD32_Int64Indices(self):
89 if np.int64 not in self.int_types:

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