code: def _safe_matmul(x: Tensor, y: Tensor) -> Tensor:
      """Safe calculation of matrix multiplication.
  
      If input is float16, will cast to float32 for computation and back again.
  
      """
      if x.dtype == torch.float16 or y.dtype == torch.float16:
          return (x.float() @ y.T.float()).half()
      return x @ y.T
  
file_path: torchmetrics/src/torchmetrics/utilities/compute.py
imports: from typing import Optional, Tuple
  import torch
  from torch import Tensor
label_desc: Use image node_id 1 for calling a global function with example usage: _safe_matmul(x, y) and returns: unknown, unknown