code: def set_tensor_model_parallel_attributes(
      tensor, is_parallel, dim, stride
  ):
      # 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: import math
  import os
  import warnings
  from typing import Callable, Optional
  import torch
  import torch.nn.functional
  import torch.nn.init
  from torch.cuda.amp import custom_bwd, custom_fwd
  from torch.nn.parameter import Parameter
  from megatron.core.model_parallel_config import ModelParallelConfig
  from megatron.core.parallel_state import get_global_memory_buffer, get_tensor_model_parallel_group, get_tensor_model_parallel_rank, get_tensor_model_parallel_world_size
  from .mappings import copy_to_tensor_model_parallel_region, gather_from_sequence_parallel_region, gather_from_tensor_model_parallel_region, reduce_from_tensor_model_parallel_region, reduce_scatter_to_sequence_parallel_region, scatter_to_tensor_model_parallel_region
  from .random import get_cuda_rng_tracker, get_expert_parallel_rng_tracker_name
  from .utils import VocabUtility, divide, split_tensor_along_last_dim
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