code: def test_correlation():
      """Test for correlation"""
      a = tl.tensor(np.random.random(10))
      b = tl.tensor(np.random.random(10))
      assert_array_almost_equal(correlation(a, a * 2 + 1), 1)
      assert_array_almost_equal(correlation(a, -a * 2 + 1), -1)
  
      a = tl.tensor([1, 2, 3, 2, 1])
      b = tl.tensor([1, 2, 3, 4, 5])
      assert_array_almost_equal(correlation(a, b), 0)
  
      a = tl.tensor([[1, 2, 3, 2, 1]] * 3)
      b = tl.tensor([[1, 2, 3, 4, 5]] * 3)
      res = tl.tensor([0, 0, 0])
      assert_array_almost_equal(correlation(a, b, axis=1), res)
  
imports: import numpy
  import tensorly
  from ..regression import MSE, RMSE, R2_score, correlation
  from ...testing import assert_array_almost_equal
label_desc: Use image node_id 4 for calling a global function with example usage: test_correlation() without return types