code: def ShardSpec(
      dims: List[int], num_partitions: List[int]
  ) -> _DistSpec:
      """ShardSpec
  
      A distributed specification represents the tensor is sharded among the tensor parallel process group.
  
      Note:
          Currently, only shard on one dimension is valid. In another word, dims should be of size 1.
  
      Args:
          dims (List[int]): a list of dimensions
          num_partitions (List[int]): a list of partition number of each dimensions.
  
      Returns:
          _DistSpec: an shard dist spec instance.
      """
      assert isinstance(dims, list) and isinstance(num_partitions, list)
      assert len(dims) == len(num_partitions)
      return _DistSpec(
          DistPlacementPattern.SHARD,
          dims=tuple(dims),
          num_partitions=tuple(num_partitions),
      )
  
file_path: colossalai/colossalai/legacy/tensor/distspec.py
imports: from enum import Enum
  from typing import List
label_desc: Use image node_id 2 for calling a global function with example usage: ShardSpec(dims, num_partitions) and returns: _DistSpec