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: Sets the shard dimension for the current policy.
  
  If the policy has been frozen then shard_dimension must match the
  existing setting.
  
  Args:
    shard_dimension: The shard dimension to use in the policy.
  
  Raises:
    ValueError: If the policy has been frozen and shard_dimension
      differs from the frozen value, or shard_dimension can't be
      interpreted as a Dimension.
docstr_tok: ["Sets","the","shard","dimension","for","the","current","policy",".","If","the","policy","has","been","frozen","then","shard_dimension","must","match","the","existing","setting",".","Args",":","shard_dimension",":","The","shard","dimension","to","use","in","the","policy",".","Raises",":","ValueError",":","If","the","policy","has","been","frozen","and","shard_dimension","differs","from","the","frozen","value",",","or","shard_dimension","ca","n't","be","interpreted","as","a","Dimension","."]
code: def set_shard_dimension(self, shard_dimension):
      """Sets the shard dimension for the current policy.
  
      If the policy has been frozen then shard_dimension must match the
      existing setting.
  
      Args:
        shard_dimension: The shard dimension to use in the policy.
  
      Raises:
        ValueError: If the policy has been frozen and shard_dimension
          differs from the frozen value, or shard_dimension can't be
          interpreted as a Dimension.
      """
      if self._frozen:
          if self._shard_dimension != shard_dimension:
              raise ValueError(
                  "Can't set shard dimension to %d since it has been frozen to "
                  "use %d." % (shard_dimension, self._shard_dimension)
              )
      else:
          self._shard_dimension = tensor_shape.as_dimension(
              shard_dimension
          )
  
file_path: tensorflow-upstream/tensorflow/python/tpu/tpu_sharding.py
imports: from tensorflow.python.framework import tensor_shape
label_desc: Use image node_id 10 for calling the ShardingPolicy obj's underlying member method code with example usage: obj.set_shard_dimension(shard_dimension) without return types