class_docstr: This is a type of PlacementSpec that defines the placement as being sharded
  across multiple devices. In particular, it represents sharding a Tensor
  along a single dimension into equal chunks (similar to :meth:`torch.chunk`).
  
  The semantics of how a tensor is partitioned is inline with
  :meth:`torch.chunk`, where ``dim`` in torch.chunk corresponds to the
  specified ``dim`` and ``chunks`` in torch.chunk is the number of elements
  in the placement specified.
  
  Args:
      dim (int or str):
          The dimension to shard on, could be an integer representing the
          dimension or a string in case of named tensors where dimensions are
          named. Note that named tensor support is not added yet.
      placement(List[Union[_remote_device, str]]):
          Specifies the placement of each shard of the Tensor. The size of
          the list represents the number of shards to be created. This could
          be a list of
          :class:`torch.distributed._remote_device`'s. This list
          could also contain a string which represents remote
          device as accepted by
          :class:`torch.distributed._remote_device`
class_docstr_tok: ["This","is","a","type","of","PlacementSpec","that","defines","the","placement","as","being","sharded","across","multiple","devices",".","In","particular",",","it","represents","sharding","a","Tensor","along","a","single","dimension","into","equal","chunks","(","similar","to",":","meth",":","`","torch.chunk","`",")",".","The","semantics","of","how","a","tensor","is","partitioned","is","inline","with",":","meth",":","`","torch.chunk","`",",","where","``","dim","``","in","torch.chunk","corresponds","to","the","specified","``","dim","``","and","``","chunks","``","in","torch.chunk","is","the","number","of","elements","in","the","placement","specified",".","Args",":","dim","(","int","or","str",")",":","The","dimension","to","shard","on",",","could","be","an","integer","representing","the","dimension","or","a","string","in","case","of","named","tensors","where","dimensions","are","named",".","Note","that","named","tensor","support","is","not","added","yet",".","placement","(","List","[","Union","[","_remote_device",",","str","]","]",")",":","Specifies","the","placement","of","each","shard","of","the","Tensor",".","The","size","of","the","list","represents","the","number","of","shards","to","be","created",".","This","could","be","a","list","of",":","class",":","`","torch.distributed._remote_device","`","'s",".","This","list","could","also","contain","a","string","which","represents","remote","device","as","accepted","by",":","class",":","`","torch.distributed._remote_device","`"]
code: def _verify_dim(dim):
      # Validate the sharding spec.
      # TODO: support named dimension
      if isinstance(dim, str):
          raise NotImplementedError(
              "ChunkShardingSpec does not support named dimension yet!"
          )
  
      if not isinstance(dim, int):
          raise ValueError(
              f"Sharding dim needs to be an integer, found: {dim}"
          )
  
file_path: pytorch/torch/distributed/_shard/sharding_spec/chunk_sharding_spec.py
imports: from dataclasses import dataclass
  import torch
  import torch.distributed._shard.sharded_tensor.metadata
  from torch.distributed._shard.metadata import ShardMetadata
  from torch.distributed._shard.sharded_tensor.shard import Shard
  from torch.distributed._shard.sharded_tensor.utils import _parse_and_validate_remote_device
  from torch.distributed._shard._utils import narrow_tensor
  import torch.distributed
  import torch.distributed.distributed_c10d
  from typing import List, Union, TYPE_CHECKING
  from ._internals import get_chunked_dim_size, get_split_size
  from .api import ShardingSpec
label_desc: Use image node_id 2 for calling the ChunkShardingSpec obj's underlying member method code with example usage: obj._verify_dim(dim) without return types