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

Method testBasic

tensorflow/compiler/tests/eager_test.py:780–799  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

778 """Test running TPU computation on more than one core."""
779
780 def testBasic(self):
781 if not multiple_tpus():
782 self.skipTest('MultiDeviceTest requires multiple TPU devices.')
783
784 # Compute 10 on TPU core 0
785 with ops.device('device:TPU:0'):
786 two = constant_op.constant(2)
787 five = constant_op.constant(5)
788 ten = two * five
789 self.assertAllEqual(10, ten)
790
791 # Compute 6 on TPU core 1
792 with ops.device('device:TPU:1'):
793 two = constant_op.constant(2)
794 three = constant_op.constant(3)
795 six = two * three
796 self.assertAllEqual(6, six)
797
798 # Copy 10 and 6 to CPU and sum them
799 self.assertAllEqual(16, ten + six)
800
801
802if __name__ == '__main__':

Callers

nothing calls this directly

Calls 4

multiple_tpusFunction · 0.85
deviceMethod · 0.45
constantMethod · 0.45
assertAllEqualMethod · 0.45

Tested by

no test coverage detected