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

Method testMap

tensorflow/compiler/tests/while_test.py:229–240  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

227
228 @test_util.enable_control_flow_v2
229 def testMap(self):
230 if is_compile_on_demand():
231 self.skipTest("list_ops are not supported in cpu_ondemand")
232 with self.session(), self.test_scope():
233 xla_context = control_flow_ops.XLAControlFlowContext()
234 xla_context.Enter()
235 nums = [1, 2, 3, 4, 5, 6]
236 elems = constant_op.constant(nums, name="data")
237 r = map_fn.map_fn(lambda x: math_ops.multiply(math_ops.add(x, 3), 2),
238 elems)
239 self.assertAllEqual(r, np.array([(x + 3) * 2 for x in nums]))
240 xla_context.Exit()
241
242
243def is_compile_on_demand():

Callers

nothing calls this directly

Calls 10

is_compile_on_demandFunction · 0.85
multiplyMethod · 0.80
sessionMethod · 0.45
test_scopeMethod · 0.45
EnterMethod · 0.45
constantMethod · 0.45
map_fnMethod · 0.45
addMethod · 0.45
assertAllEqualMethod · 0.45
ExitMethod · 0.45

Tested by

no test coverage detected