code: def cast_if_src_dtype(
      tensor: torch.Tensor,
      src_dtype: torch.dtype,
      tgt_dtype: torch.dtype,
  ):
      updated = False
      if tensor.dtype == src_dtype:
          tensor = tensor.to(dtype=tgt_dtype)
          updated = True
      return tensor, updated
  
imports: import einops
  import numpy
  import torch
  import torch.nn
label_desc: Use image node_id 1 for calling a global function with example usage: cast_if_src_dtype(tensor, src_dtype, tgt_dtype) and returns: tensor,  updated