code: def cov(
      x1: torch.Tensor,
      x2: torch.Tensor = None,
      /,
      *,
      rowVar: bool = True,
      bias: bool = False,
      ddof: Optional[int] = None,
      fweights: Optional[torch.Tensor] = None,
      aweights: Optional[torch.Tensor] = None,
      dtype: Optional[torch.dtype] = None,
  ) -> torch.Tensor:
      # dtype casts separately
      if fweights is not None:
          fweights = fweights.type(torch.int64)
      if aweights is not None:
          aweights = aweights.type(torch.float64)
  
      if x1.dim() > 2:
          raise ValueError("x1 has more than 2 dimensions")
  
      if x2 is not None:
          if x2.dim() > 2:
              raise ValueError("x2 has more than 2 dimensions")
  
      if ddof is None:
          if bias == 0:
              ddof = 1
          else:
              ddof = 0
  
      if dtype is None:
          x1 = x1.type(torch.float64)
          if x2 is not None:
              x2 = x2.type(torch.float64)
      else:
          x1 = x1.type(dtype)
          if x2 is not None:
              x2 = x2.type(dtype)
  
      X = x1
      if not rowVar and len(x1.shape) != 1:
          X = torch.t(x1)
  
      if x2 is not None:
          if not rowVar and len(x2.shape) != 1:
              x2 = torch.t(x2)
          X = torch.vstack((X, x2))
  
      return torch.cov(
          X, correction=ddof, fweights=fweights, aweights=aweights
      )
  
imports: from typing import Optional, Union, Tuple, Sequence
  import torch
  from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
  from .None import backend_version
  import ivy
  from ..statistical import _infer_dtype
  from copy import deepcopy
label_desc: Use image node_id 17 for calling a global function with example usage: cov() and returns: torch