class_docstr: Test various Torch Generator agent behaviors.
class_docstr_tok: ["Test","various","Torch","Generator","agent","behaviors","."]
docstr: Test --inference with simple options.
docstr_tok: ["Test","--","inference","with","simple","options","."]
code: def test_upgrade_opt_inference(self):
      """
      Test --inference with simple options.
      """
      upgraded = TorchGeneratorAgent.upgrade_opt({"beam_size": 1})
      self.assertEqual(upgraded["inference"], "greedy")
  
      upgraded = TorchGeneratorAgent.upgrade_opt({"beam_size": 5})
      self.assertEqual(upgraded["inference"], "beam")
  
imports: import unittest
  import math
  import torch
  from parlai.core.agents import create_agent
  from parlai.core.dict import DictionaryAgent
  import parlai.utils.testing
  from parlai.core.params import ParlaiParser
  from parlai.core.torch_generator_agent import BeamSearch, GreedySearch, NucleusSampling, FactualNucleusSampling, TopKSampling, TorchGeneratorAgent
  from parlai.agents.test_agents.transformer_generator_prefix import PREFIX_TEXT
label_desc: Use image node_id 1 for calling the TestTGA obj's underlying member method code with example usage: obj.test_upgrade_opt_inference() without return types