code: def _upcast(t: Tensor) -> Tensor:
      # Protects from numerical overflows in multiplications by upcasting to the equivalent higher type
      if t.is_floating_point():
          return (
              t
              if t.dtype in (torch.float32, torch.float64)
              else t.float()
          )
      else:
          return t if t.dtype in (torch.int32, torch.int64) else t.int()
  
file_path: vision/torchvision/ops/_utils.py
imports: from typing import List, Optional, Tuple, Union
  import torch
  from torch import nn, Tensor
label_desc: Use image node_id 5 for calling a global function with example usage: _upcast(t) and returns: unknown, unknown