code: def _raise_if_mismatch(
      expected, actual, prop_name, ranks, is_local=True
  ):
      if is_local:
          assert isinstance(ranks, int)
          if expected != actual:
              raise ValueError(
                  f"Local shards' tensor {prop_name} property need to be the same on rank:{ranks}! "
                  f"Found one local shard tensor {prop_name}={expected}, "
                  f"the other local shard tensor {prop_name}={actual}."
              )
      else:
          # compare failure check across ranks, ranks list should have two rank
          assert len(ranks) == 2
          if expected != actual:
              raise ValueError(
                  f"ShardedTensor {prop_name} property does not match from different ranks! "
                  f"Found {prop_name}={expected} on rank:{ranks[0]}, "
                  f"and {prop_name}={actual} on rank:{ranks[1]}."
              )
  
file_path: pytorch/torch/distributed/_shard/sharded_tensor/utils.py
imports: import collections.abc
  import copy
  from typing import Optional, List, Sequence
  import torch
  from torch.distributed import distributed_c10d
  from torch.distributed import rpc
  from torch.distributed._shard.sharding_spec._internals import check_tensor, validate_non_overlapping_shards_metadata
  from torch.distributed._shard.metadata import ShardMetadata
  from .metadata import TensorProperties, ShardedTensorMetadata
  from .shard import Shard
label_desc: Use image node_id 4 for calling a global function with example usage: _raise_if_mismatch(expected, actual, prop_name, ranks, is_local) without return types