code: def dim_repeat(ndim: int, sizes: Shape) -> DimMap:
      sizes = normalize_sizes(sizes)
      assert (
          len(sizes) >= ndim
      ), f"Number of dimensions of repeat dims {sizes} can not be smaller than number of dimensions of tensor {ndim}."
      pad = len(sizes) - ndim
      return tuple(
          Repeat.new(Singleton(), s) for s in sizes[:pad]
      ) + tuple(
          Repeat.new(InputDim(i), s) for i, s in enumerate(sizes[pad:])
      )
  
imports: from dataclasses import dataclass
  from typing import Callable, cast, Dict, Iterable, Optional, Sequence, Set, Tuple, Union
  import torch
  from torch import Tensor
  from torch._subclasses.fake_tensor import unset_fake_temporarily
  from torch.distributed._tensor._utils import compute_local_shape
  from torch.distributed._tensor.api import Shard
  from torch.distributed._tensor.op_schema import OpSchema, OutputSharding, RuntimeSchemaInfo
  from torch.distributed._tensor.ops.utils import normalize_dim, normalize_dims, prod, register_prop_rule
  from torch.distributed._tensor.placement_types import DTensorSpec, Placement, Replicate
  from torch.fx.experimental.proxy_tensor import disable_proxy_modes_tracing
label_desc: Use image node_id 7 for calling a global function with example usage: dim_repeat(ndim, sizes) and returns: unknown