class_docstr: An object use to hold the sharding policy for a Tensor.
class_docstr_tok: ["An","object","use","to","hold","the","sharding","policy","for","a","Tensor","."]
docstr: Return the unsharded shape that would generate a given sharded shape.
  
  Args:
    shape: the sharded shape to unshard
  
  Returns:
    The unsharded shape.
  
  Raises:
    ValueError: if shape is unknown or does not contain
      self.shard_dimension
    TypeError: if shape is not convertible to a TensorShape
docstr_tok: ["Return","the","unsharded","shape","that","would","generate","a","given","sharded","shape",".","Args",":","shape",":","the","sharded","shape","to","unshard","Returns",":","The","unsharded","shape",".","Raises",":","ValueError",":","if","shape","is","unknown","or","does","not","contain","self.shard_dimension","TypeError",":","if","shape","is","not","convertible","to","a","TensorShape"]
code: def _unshard_shape(self, shape):
      """Return the unsharded shape that would generate a given sharded shape.
  
      Args:
        shape: the sharded shape to unshard
  
      Returns:
        The unsharded shape.
  
      Raises:
        ValueError: if shape is unknown or does not contain
          self.shard_dimension
        TypeError: if shape is not convertible to a TensorShape
      """
      shape = tensor_shape.as_shape(shape)
      if self._number_of_shards == 1:
          # Don't do anything when there's only one shard.
          return shape
      ndims = shape.ndims
      if ndims is None:
          raise ValueError(f"Shape {shape} must be statically known.")
      if ndims <= self._shard_dimension:
          raise ValueError(
              f"Shape {shape.as_list()} does not contain "
              f"shard_dimension {self._shard_dimension}. "
              f"Rank is too small."
          )
      dims = shape.as_list()
      dims[self._shard_dimension] *= self._number_of_shards
      return tensor_shape.TensorShape(dims)
  
file_path: tensorflow-upstream/tensorflow/python/tpu/tpu_sharding.py
imports: from tensorflow.python.framework import tensor_shape
label_desc: Use image node_id 14 for calling the ShardingPolicy obj's underlying member method code with example usage: obj._unshard_shape(shape) and returns: tensor_shape, shape