code: def test_gumbel_softmax_optimizer_discrete(self):
      batch_size = 32
      anneal_rate = 0.97
      learning_rate = 0.1
      input_param = discrete_input_param()
      gt_net = create_ground_truth_net(input_param)
      obj_func = create_discrete_choice_gumbel_softmax_obj_func(
          input_param, gt_net
      )
      optimizer = GumbelSoftmaxOptimizer(
          input_param,
          obj_func,
          anneal_rate=anneal_rate,
          batch_size=batch_size,
          learning_rate=learning_rate,
      )
  
      obj_func_rs = create_discrete_choice_obj_func(input_param, gt_net)
      best_rs_result = random_sample(
          input_param, obj_func_rs, n_generations=20
      )
  
      n_generations = 100
      for i in range(n_generations):
          (
              sampled_softmax_vals,
              reward,
              logits,
          ) = optimizer.optimize_step()
          mean_reward = torch.mean(reward.data)
          print(
              f"Generation={i}, mean_reward={mean_reward}, "
              f"min_reward={torch.min(reward.data)}, "
              f"temperature={optimizer.temp}"
          )
      assert (
          optimizer.temp == optimizer.min_temp
      ), "Towards the end of learning, GumbelSoftmax Optimizer should have a low temperature"
      assert (
          abs(best_rs_result - mean_reward) < GUMBEL_SOFTMAX_TEST_THRES
      ), f"Learning not converged. best random search={best_rs_result}, optimizer mean result={mean_reward}"
      eval_obj_func = create_discrete_choice_obj_func(
          input_param, gt_net
      )
      eval_result = eval_obj_func(optimizer.sample(1))
      assert (
          abs(best_rs_result - eval_result) < GUMBEL_SOFTMAX_TEST_THRES
      ), f"Learning not converged. best random search={best_rs_result}, eval result={eval_result}"
  
imports: import random
  import unittest
  from collections import defaultdict
  from typing import Dict
  import nevergrad
  import numpy
  import torch
  import torch.nn
  from reagent.lite.optimizer import BayesianByBackpropOptimizer, BayesianMLPEnsemblerOptimizer, BayesianOptimizerBase, GREEDY_TEMP, GumbelSoftmaxOptimizer, NeverGradOptimizer, PolicyGradientOptimizer, QLearningOptimizer, RandomSearchOptimizer, sol_to_tensors
label_desc: Use image node_id 8 for calling the TestComboOptimizer obj's underlying member method code with example usage: obj.test_gumbel_softmax_optimizer_discrete() without return types