code: def test_corr(self) -> None:
      pred = torch.randn(100, 5)
      target = torch.randn(100, 5)
      weights = torch.zeros(100, 1)
      weights[:30] = weights[-30:] = 1.0
      corr00 = corr(pred, pred, weights)
      corr01 = corr(pred, target, weights)
      corr02 = corr(target, pred, weights)
      w_pred = pred[list(range(30)) + list(range(70, 100))]
      w_target = target[list(range(30)) + list(range(70, 100))]
      corr10 = corr(w_pred, w_pred)
      corr11 = corr(w_pred, w_target)
      corr12 = corr(w_target, w_pred)
      self.assertTrue(allclose(corr00, corr10, atol=1.0e-5))
      self.assertTrue(
          allclose(corr01, corr11, corr02.t(), corr12.t(), atol=1.0e-5)
      )
  
file_path: carefree-learn/tests/test_toolkit.py
imports: import torch
  import unittest
  from cftool.array import corr
  from cftool.array import allclose
  from cflearn.misc.toolkit import auto_num_layers
label_desc: Use image node_id 2 for calling the TestToolkit obj's underlying member method code with example usage: obj.test_corr() without return types