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

Method merge

tensorflow/python/tpu/tpu_sharding.py:122–135  ·  view source on GitHub ↗

Merges the policy of another policy into the current policy. Args: other: The policy to merge into this one. Raises: ValueError: If this policy has been frozen and the merge conflicts with the frozen policy.

(self, other)

Source from the content-addressed store, hash-verified

120 self._shard_dimension = tensor_shape.as_dimension(shard_dimension)
121
122 def merge(self, other):
123 """Merges the policy of another policy into the current policy.
124
125 Args:
126 other: The policy to merge into this one.
127
128 Raises:
129 ValueError: If this policy has been frozen and the merge conflicts with
130 the frozen policy.
131 """
132 if other.number_of_shards is not None:
133 self.set_number_of_shards(other.number_of_shards)
134 if other.shard_dimension is not None:
135 self.set_shard_dimension(other.shard_dimension)
136
137 def get_sharded_shape(self, shape, shard_index=None):
138 """Returns the shape of a shard of a full Tensor.

Callers 1

testMergeMethod · 0.95

Calls 2

set_number_of_shardsMethod · 0.95
set_shard_dimensionMethod · 0.95

Tested by 1

testMergeMethod · 0.76