code: def set_tensor_model_parallel_attributes(
      tensor: torch.Tensor, is_parallel: bool, dim: int, stride: int
  ) -> None:
      # Make sure the attributes are not set.
      for attribute in _MODEL_PARALLEL_ATTRIBUTE_DEFAULTS:
          assert not hasattr(tensor, attribute)
      # Set the attributes.
      setattr(tensor, "tensor_model_parallel", is_parallel)
      setattr(tensor, "partition_dim", dim)
      setattr(tensor, "partition_stride", stride)
  
imports: from typing import Optional, Dict, Tuple, List
  import warnings
  import torch
  import torch.nn.functional
  import torch.nn.init
  from torch.nn.parameter import Parameter
  from apex._autocast_utils import _cast_if_autocast_enabled
  from apex.transformer.parallel_state import get_tensor_model_parallel_group
  from apex.transformer.parallel_state import get_tensor_model_parallel_rank
  from apex.transformer.parallel_state import get_tensor_model_parallel_world_size
  from apex.transformer.utils import divide
  from apex.transformer.tensor_parallel.mappings import copy_to_tensor_model_parallel_region
  from apex.transformer.tensor_parallel.mappings import gather_from_tensor_model_parallel_region
  from apex.transformer.tensor_parallel.mappings import reduce_from_tensor_model_parallel_region
  from apex.transformer.tensor_parallel.mappings import scatter_to_tensor_model_parallel_region
  from apex.transformer.tensor_parallel.mappings import reduce_scatter_to_sequence_parallel_region
  from apex.transformer.tensor_parallel.random import get_cuda_rng_tracker
  from apex.transformer.tensor_parallel.utils import VocabUtility
  from apex.transformer.log_util import get_transformer_logger
label_desc: Use image node_id 2 for calling a global function with example usage: set_tensor_model_parallel_attributes(tensor, is_parallel, dim, stride) without return types