code: def _load_from_array(
      sharded_tensor: ShardedTensor,
      checkpoint_dir: Path,
      load_directly_on_device: bool = False,
      apply_flattened_range: bool = True,
  ):
      x = _load_regular_chunk(sharded_tensor, checkpoint_dir)
      ten = postprocess_numpy_array(
          x, sharded_tensor, apply_flattened_range
      )
      if load_directly_on_device:
          sharded_tensor.data.data.copy_(ten)
          return sharded_tensor.data
      else:
          return ten
  
imports: from functools import partial
  from itertools import starmap
  from logging import getLogger
  from pathlib import Path
  import tensorstore
  import torch
  from ..core import CheckpointingException
  from ..dict_utils import dict_list_map_inplace
  from ..mapping import ShardedStateDict, ShardedTensor
  from .base import LoadShardedStrategy, StrategyAction, default_strategies
  from .zarr import load_zarr_based_sharded_metadata, numpy_to_torch_dtype_dict, postprocess_numpy_array
label_desc: Use image node_id 2 for calling a global function with example usage: _load_from_array(sharded_tensor, checkpoint_dir, load_directly_on_device, apply_flattened_range) and returns: sharded_tensor, ten