code: def test_contraction(self):
      mode_a = cutensor.create_mode("m", "k")
      mode_b = cutensor.create_mode("k", "n")
      mode_c = cutensor.create_mode("m", "n")
      cutensor.contraction(
          self.alpha,
          self.a,
          mode_a,
          self.b,
          mode_b,
          self.beta,
          self.c,
          mode_c,
      )
      cupy.testing.assert_allclose(
          self.c, self.c_ref, rtol=self.tol, atol=self.tol
      )
  
      # test the contraction descriptor cache (issues #7318, #7812)
      del mode_b
      gc.collect()
      mode_b = cutensor.create_mode("n", "k")  # flipped
      self.c_ref = self.alpha * cupy.matmul(self.a, self.b.T)
      self.c_ref += self.beta * self.c
      cutensor.contraction(
          self.alpha,
          self.a,
          mode_a,
          self.b,
          mode_b,
          self.beta,
          self.c,
          mode_c,
      )
      cupy.testing.assert_allclose(
          self.c, self.c_ref, rtol=self.tol, atol=self.tol
      )
  
imports: import gc
  import numpy
  import pytest
  import cupy
  from cupy._core import _routines_linalg
  from cupy import testing
  from cupy.cuda import device
  from cupy.cuda import cutensor
label_desc: Use image node_id 4 for calling the TestCuTensorContraction obj's underlying member method code with example usage: obj.test_contraction() without return types