class_docstr: Agents than plays through a torch neural network
class_docstr_tok: ["Agents","than","plays","through","a","torch","neural","network"]
code: def from_module_maker(
      cls,
      env: AnyEnv,
      module_maker: tp.Callable[[tp.Tuple[int, ...], int], nn.Module],
      deterministic: bool = True,
  ) -> "TorchAgent":
      assert isinstance(env.action_space, gym.spaces.Discrete)
      assert isinstance(env.observation_space, gym.spaces.Box)
      module = module_maker(
          env.observation_space.shape, env.action_space.n
      )
      return cls(module, deterministic=deterministic)
  
imports: import warnings
  import operator
  import copy
  import typing
  import gym
  import numpy
  from nevergrad.common.tools import pytorch_import_fix
  from nevergrad.parametrization import parameter
  from ..base import ExperimentFunction
  from .None import base
  from .None import envs
  import torch
  import torch.nn.functional
  from torch import nn
  from torch.utils.data import WeightedRandomSampler
label_desc: Use image node_id 2 for calling the TorchAgent obj's underlying member method code with example usage: obj.from_module_maker(cls, env, module_maker, deterministic) and returns: cls