class_docstr: Base class representing sharding specifications.
class_docstr_tok: ["Base","class","representing","sharding","specifications","."]
docstr: Given a global tensor size, define how to shard a tensor like this shape
  across ranks, return ShardedTensorMetadata
  Args:
      tensor_sizes (:class:`torch.Size`):
          The tensor shape to shard on, a `torch.Size` object that represents the
          tensor shape to be sharded according to the ShardingSpec.
      tensor_properties(:class:`torch.distributed._shard.sharded_tensor.TensorProperties):
          Tensor properties used to create a ShardedTensor.
  Returns:
      A :class:`ShardedTensorMetadata` object that encodes the information about
      the layout of the ShardedTensor and its properties.
docstr_tok: ["Given","a","global","tensor","size",",","define","how","to","shard","a","tensor","like","this","shape","across","ranks",",","return","ShardedTensorMetadata","Args",":","tensor_sizes","(",":","class",":","`","torch.Size","`",")",":","The","tensor","shape","to","shard","on",",","a","`","torch.Size","`","object","that","represents","the","tensor","shape","to","be","sharded","according","to","the","ShardingSpec",".","tensor_properties","(",":","class",":","`","torch.distributed._shard.sharded_tensor.TensorProperties",")",":","Tensor","properties","used","to","create","a","ShardedTensor",".","Returns",":","A",":","class",":","`","ShardedTensorMetadata","`","object","that","encodes","the","information","about","the","layout","of","the","ShardedTensor","and","its","properties","."]
code: def build_metadata(
      self,
      tensor_sizes: torch.Size,
      tensor_properties: sharded_tensor_meta.TensorProperties,
  ) -> sharded_tensor_meta.ShardedTensorMetadata:
      """
      Given a global tensor size, define how to shard a tensor like this shape
      across ranks, return ShardedTensorMetadata
      Args:
          tensor_sizes (:class:`torch.Size`):
              The tensor shape to shard on, a `torch.Size` object that represents the
              tensor shape to be sharded according to the ShardingSpec.
          tensor_properties(:class:`torch.distributed._shard.sharded_tensor.TensorProperties):
              Tensor properties used to create a ShardedTensor.
      Returns:
          A :class:`ShardedTensorMetadata` object that encodes the information about
          the layout of the ShardedTensor and its properties.
      """
  
imports: from abc import ABC, abstractmethod
  from dataclasses import dataclass
  import functools
  from typing import Callable, Dict, List, TYPE_CHECKING
  import torch
  from ._internals import check_tensor, get_chunked_dim_size, get_split_size, validate_non_overlapping_shards_metadata
  from torch.distributed._shard.metadata import ShardMetadata
  import torch.distributed._shard.sharded_tensor.metadata
  from torch.distributed._shard.op_registry_utils import _decorator_func
label_desc: Use image node_id 1 for calling the ShardingSpec obj's underlying member method code with example usage: obj.build_metadata(tensor_sizes, tensor_properties) without return types