code: def test_batch_quadratic_form(self) -> None:
      def check_correctness(x, A):
          batch_result = batch_quadratic_form_multi_arms(x, A)
          batch_size = x.size()[0]
          num_arms = A.size()[0]
          loop_result = torch.zeros(
              (batch_size, num_arms)
          )  # batch_size * num_arms
  
          for i in range(num_arms):
              a = A[i]
              for j in range(batch_size):
                  loop_result[j][i] = x[j].t() @ a @ x[j]
          npt.assert_allclose(
              batch_result.numpy(), loop_result.numpy(), rtol=1e-3
          )
  
      x1 = torch.tensor([[1.0, 4.3], [3.2, 9.8]])
      A1 = torch.tensor(
          [
              [[2.0, 1.0], [2.4, 0.5]],
              [[2.0, 0], [0, 3.0]],
              [[4.6, 8.0], [3.6, 0.7]],
          ]
      )
      check_correctness(x1, A1)
  
      torch.manual_seed(0)
      # x (B,N); A (num_arms, N, N)
  
      # equal num_arms and batch size
      x2 = torch.randn((8, 10))
      A2 = torch.randn((8, 10, 10))
      check_correctness(x2, A2)
  
      # equal batch size and N
      x3 = torch.randn((8, 8))
      A3 = torch.randn((3, 8, 8))
      check_correctness(x3, A3)
  
      # equal num_arms and N
      x4 = torch.randn((10, 3))
      A4 = torch.randn((3, 3, 3))
      check_correctness(x4, A4)
  
      # batch size != N != num_arms
      x5 = torch.randn((10, 8))
      A5 = torch.randn((4, 8, 8))
      check_correctness(x5, A5)
  
      # batch size = N = num_arms
      x6 = torch.randn((10, 10))
      A6 = torch.randn((10, 10, 10))
      check_correctness(x6, A6)
  
file_path: ReAgent/reagent/test/models/test_disjoint_linucb_predictor.py
imports: import unittest
  import numpy
  import numpy.testing
  import torch
  from reagent.core.types import CBInput
  from reagent.gym.policies.policy import Policy
  from reagent.gym.policies.samplers.discrete_sampler import GreedyActionSampler
  from reagent.models.disjoint_linucb_predictor import batch_quadratic_form_multi_arms, DisjointLinearRegressionUCB
  from reagent.training.cb.disjoint_linucb_trainer import DisjointLinUCBTrainer
label_desc: Use image node_id 1 for calling the TestDisjointLinearRegressionUCBUtils obj's underlying member method code with example usage: obj.test_batch_quadratic_form() without return types