docstr: Test whether BanditLinUCB can be built on all frameworks.
docstr_tok: ["Test","whether","BanditLinUCB","can","be","built","on","all","frameworks","."]
code: def test_bandit_lin_ucb_compilation(self):
      """Test whether BanditLinUCB can be built on all frameworks."""
      config = (
          BanditLinUCBConfig()
          .environment(env=SimpleContextualBandit)
          .rollouts(num_envs_per_worker=2)
      )
  
      num_iterations = 5
  
      for _ in framework_iterator(
          config, frameworks=("tf2", "torch"), with_eager_tracing=True
      ):
          for train_batch_size in [1, 10]:
              config.training(train_batch_size=train_batch_size)
              algo = config.build()
              results = None
              for i in range(num_iterations):
                  results = algo.train()
                  check_train_results(results)
                  print(results)
              # Force good learning behavior (this is a very simple env).
              self.assertTrue(results["episode_reward_mean"] == 10.0)
              algo.stop()
  
imports: import unittest
  import gymnasium
  import numpy
  from gymnasium.spaces import Box, Discrete
  from rllib_bandit.bandit.bandit import BanditLinTSConfig, BanditLinUCBConfig
  from rllib_bandit.env.bandit_envs_discrete import SimpleContextualBandit
  import ray
  from ray.rllib.env import EnvContext
  from ray.rllib.utils.numpy import convert_to_numpy
  from ray.rllib.utils.test_utils import check, check_train_results, framework_iterator
label_desc: Use image node_id 4 for calling the TestBandits obj's underlying member method code with example usage: obj.test_bandit_lin_ucb_compilation() without return types