code: def _create_tensor_from_params(
      *size, local_device, tensor_properties: TensorProperties
  ):
      """Helper to construct tensor from size, device and common params."""
      dtype = tensor_properties.dtype
      layout = tensor_properties.layout
      requires_grad = tensor_properties.requires_grad
      memory_format = tensor_properties.memory_format
      pin_memory = tensor_properties.pin_memory
  
      return torch.empty(
          *size,
          dtype=dtype,
          layout=layout,
          device=local_device,
          requires_grad=requires_grad,
          memory_format=memory_format,
          pin_memory=pin_memory,
      )
  
imports: from __future__ import annotations
  from dataclasses import dataclass
  from typing import Callable, Dict, List, Optional, Sequence, Tuple, cast
  import copy
  import warnings
  from functools import reduce
  import weakref
  import threading
  import torch
  import torch.distributed
  from torch.distributed import rpc
  from torch.distributed import distributed_c10d
  from torch.distributed._shard.metadata import ShardMetadata
  import torch.distributed._shard.sharding_spec
  from torch.distributed._shard.sharding_spec.api import _dispatch_custom_op, _has_custom_op
  from torch.distributed._shard.sharding_spec._internals import check_tensor, validate_non_overlapping_shards_metadata
  from torch.distributed._shard._utils import DEPRECATE_MSG
  from .metadata import TensorProperties, ShardedTensorMetadata
  from .shard import Shard
  from .reshard import reshuffle_local_shard, reshard_local_shard
  from .utils import _flatten_tensor_size, _parse_and_validate_remote_device, _validate_output_tensor_for_gather, build_metadata_from_local_shards, build_global_metadata
  from torch.distributed.remote_device import _remote_device
  from torch.utils import _pytree
  import operator
label_desc: Use image node_id 2 for calling a global function with example usage: _create_tensor_from_params() and returns: torch