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

Method testFreeze

tensorflow/python/tpu/tpu_sharding_test.py:30–42  ·  view source on GitHub ↗

Tests that freezing a policy applies default values.

(self)

Source from the content-addressed store, hash-verified

28class ShardingTest(test.TestCase):
29
30 def testFreeze(self):
31 """Tests that freezing a policy applies default values."""
32 p1 = tpu_sharding.ShardingPolicy()
33 p1.freeze()
34 self.assertEqual(p1.number_of_shards,
35 tpu_sharding._DEFAULT_NUMBER_OF_SHARDS)
36 self.assertEqual(p1.shard_dimension, tpu_sharding._DEFAULT_SHARD_DIMENSION)
37 p2 = tpu_sharding.ShardingPolicy()
38 p2.set_number_of_shards(17)
39 p2.set_shard_dimension(23)
40 p2.freeze()
41 self.assertEqual(p2.number_of_shards, 17)
42 self.assertEqual(p2.shard_dimension, 23)
43
44 def testFrozen(self):
45 """Tests that frozen policies can't be changed."""

Callers

nothing calls this directly

Calls 3

freezeMethod · 0.95
set_number_of_shardsMethod · 0.95
set_shard_dimensionMethod · 0.95

Tested by

no test coverage detected