code: def test_torch_agent_function() -> None:
      mgame = envs.DoubleOSeven()
      game = mgame.with_agent(
          player_1=agents.RandomAgent(mgame)
      ).as_single_agent()
      agent = agents.TorchAgent.from_module_maker(game, agents.DenseNet)
      runner = base.EnvironmentRunner(game)
      agentfunction = agents.TorchAgentFunction(agent, runner)
      instru = agentfunction.parametrization
      args, kwargs = (
          instru.spawn_child()
          .set_standardized_data([0] * instru.dimension)
          .value
      )
      assert not args
      value = agentfunction.compute(**kwargs)
      assert value in [0, -1]  # negated reward, for minimization
      # optimization
      opt = optimizerlib.OnePlusOne(instru, budget=10)
      opt.minimize(agentfunction.compute)
  
file_path: nevergrad/nevergrad/functions/rl/test_agents.py
imports: import numpy
  import pytest
  from nevergrad.optimization import optimizerlib
  from nevergrad.optimization import helpers
  from .None import agents
  from .None import envs
  from .None import base
label_desc: Use image node_id 4 for calling a global function with example usage: test_torch_agent_function() without return types