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

Method set_shard_dimensions

tensorflow/python/tpu/tpu_feed.py:314–337  ·  view source on GitHub ↗

Sets the shard_dimension of each element of the queue. shard_dimensions must be a list of length self.number_of_tuple_elements, and each element must be convertible to a Dimension compatible with self.tuple_shapes. Args: shard_dimensions: the dimensions of each queue element.

(self, shard_dimensions)

Source from the content-addressed store, hash-verified

312 return [policy.shard_dimension for policy in self._sharding_policies]
313
314 def set_shard_dimensions(self, shard_dimensions):
315 """Sets the shard_dimension of each element of the queue.
316
317 shard_dimensions must be a list of length
318 self.number_of_tuple_elements, and each element must be
319 convertible to a Dimension compatible with self.tuple_shapes.
320
321 Args:
322 shard_dimensions: the dimensions of each queue element.
323
324 Raises:
325 ValueError: if shard_dimensions is not of length
326 self.number_of_tuple_elements; or an element of
327 shard_dimensions cannot be converted to a Dimension; or an
328 element of shard_dimensions is a Dimension that is out of
329 range for the corresponding tuple element shape.
330 """
331 if len(shard_dimensions) != self.number_of_tuple_elements:
332 raise ValueError("shard_dimensions is %s, but must be a list of length %d"
333 % (str(shard_dimensions),
334 self.number_of_tuple_elements))
335 for (policy, dimension) in zip(self._sharding_policies, shard_dimensions):
336 policy.set_shard_dimension(dimension)
337 self._validate()
338
339 @property
340 def number_of_shards(self):

Callers 3

__init__Method · 0.95
testModificationMethod · 0.95
testFreezingMethod · 0.95

Calls 2

_validateMethod · 0.95
set_shard_dimensionMethod · 0.80

Tested by 2

testModificationMethod · 0.76
testFreezingMethod · 0.76