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

Method testSerialization

tensorflow/python/tpu/topology_test.py:28–42  ·  view source on GitHub ↗

Tests if the class is able to generate serialized strings.

(self)

Source from the content-addressed store, hash-verified

26class TopologyTest(test.TestCase):
27
28 def testSerialization(self):
29 """Tests if the class is able to generate serialized strings."""
30 original_topology = topology.Topology(
31 mesh_shape=[1, 1, 2],
32 device_coordinates=[[[0, 0, 0], [0, 0, 1]]],
33 )
34 serialized_str = original_topology.serialized()
35 new_topology = topology.Topology(serialized=serialized_str)
36
37 # Make sure the topology recovered from serialized str is same as the
38 # original topology.
39 self.assertAllEqual(
40 original_topology.mesh_shape, new_topology.mesh_shape)
41 self.assertAllEqual(
42 original_topology.device_coordinates, new_topology.device_coordinates)
43
44if __name__ == "__main__":
45 test.main()

Callers

nothing calls this directly

Calls 2

serializedMethod · 0.95
assertAllEqualMethod · 0.45

Tested by

no test coverage detected