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

Method _testMediumTopK

tensorflow/python/kernel_tests/topk_op_test.py:142–150  ·  view source on GitHub ↗
(self, dtype)

Source from the content-addressed store, hash-verified

140 self._testLargeTopK(np.float16)
141
142 def _testMediumTopK(self, dtype):
143 b = 5
144 n = 500
145 k = 50
146 inputs = np.random.permutation(
147 np.linspace(0, 100, b * n, dtype=dtype)).reshape(b, n)
148 indices = np.argsort(-inputs, axis=1)[:, :k]
149 values = -np.sort(-inputs, axis=1)[:, :k]
150 self._validateTopK(inputs, k, values, indices)
151
152 def testMediumTopK(self):
153 self._testMediumTopK(np.float32)

Callers 1

testMediumTopKMethod · 0.95

Calls 4

_validateTopKMethod · 0.95
reshapeMethod · 0.80
permutationMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected