code: def r2_score(pred:Tensor, targ:Tensor)->Rank0Tensor:
      "R2 score (coefficient of determination) between `pred` and `targ`."
      pred,targ = flatten_check(pred,targ)
      u = torch.sum((targ - pred) ** 2)
      d = torch.sum((targ - targ.mean()) ** 2)
      return 1 - u / f r2_score(pred:Tensor, targ:Tensor)->Rank0Tensor:
      "R2 score (coefficient of determination) between `pred` and `targ`."
      pred,targ = flatten_check(pred,targ)
      u = torch.sum((targ - pred) ** 2)
      d = torch.sum((targ - targ.mean()) ** 2)
      return 1 - u / d
docs: R2 score (coefficient of determination) between `pred` and `targ`.