code: def load_tensors_metadata(
      checkpoint_dir: str,
      sharded_strategy: Union[LoadShardedStrategy, None] = None,
  ) -> ShardedStateDict:
      """Load tensors metadata from the checkpoint.
  
      Returns a dictionary similar to a sharded state dict, but note that
      the dictionary keys are simply ShardedTensor keys (contrary to the
      actual sharded state dicts where keys correspond to state dict keys).
  
      Dict values are ShardedTensors without any sharding (so, the only useful
      information is tensors global shape and dtype).
  
      Concrete implementation depends on the loading strategy. If no strategy is
      given, a default for a given backend is used.
      """
      sharded_strategy = _verify_checkpoint_and_load_strategy(
          checkpoint_dir, sharded_strategy
      )
      return sharded_strategy.load_tensors_metadata(
          Path(checkpoint_dir)
      )
  
imports: import logging
  import os
  from collections import Counter, defaultdict
  from itertools import chain
  from pathlib import Path
  from typing import Iterable, List, Optional, Tuple, Union
  import numpy
  import torch
  from .core import CheckpointingConfig, maybe_load_config, save_config
  from .dict_utils import dict_list_map_inplace, diff, extract_matching_values, map_reduce, merge, nested_values
  from .mapping import CheckpointingException, ShardedObject, ShardedStateDict, ShardedTensor, ShardedTensorFactory, StateDict, apply_factories, apply_factory_merges, is_main_replica
  from .strategies.base import LoadCommonStrategy, LoadShardedStrategy, SaveCommonStrategy, SaveShardedStrategy, StrategyAction, get_default_strategy
  from .utils import extract_sharded_tensors, extract_sharded_tensors_or_nonpersistent
label_desc: Use image node_id 5 for calling a global function with example usage: load_tensors_metadata(checkpoint_dir, sharded_strategy) and returns: sharded_strategy