class_docstr: | `alias`: ``parl.Agent``
  | `alias`: ``parl.core.paddle.agent.Agent``
  
  | Agent is one of the three basic classes of PARL.
  
  | It is responsible for interacting with the environment and collecting 
  data for training the policy.
  | To implement a customized ``Agent``, users can:
  
    .. code-block:: python
  
      import parl
  
      class MyAgent(parl.Agent):
          def __init__(self, algorithm, act_dim):
              super(MyAgent, self).__init__(algorithm)
              self.act_dim = act_dim
  
  Attributes:
      alg (parl.algorithm): algorithm of this agent.
  
  Public Functions:
      - ``sample``: return a noisy action to perform exploration according to the policy.
      - ``predict``: return an action given current observation.
      - ``learn``: update the parameters of self.alg using the `learn_program` defined in `build_program()`.
      - ``save``: save parameters of the ``agent`` to a given path.
      - ``restore``: restore previous saved parameters from a given path.
      - ``train``: set the agent in training mode.
      - ``eval``: set the agent in evaluation mode.
  
  Todo:
      - allow users to get parameters of a specified model by specifying the model's name in ``get_weights()``.
docstr: Sets the agent in training mode, which is the default setting.
  Model of agent will be affected if it has some modules (e.g. Dropout, BatchNorm) that behave differently in train/evaluation mode.
  
  Example:
  
  .. code-block:: python
  
      agent.train()   # default setting
      assert (agent.training is True)
      agent.eval()
      assert (agent.training is False)
docstr_tok: ["Sets","the","agent","in","training","mode",",","which","is","the","default","setting",".","Model","of","agent","will","be","affected","if","it","has","some","modules","(","e.g",".","Dropout",",","BatchNorm",")","that","behave","differently","in","train\/evaluation","mode",".","Example",":","..","code-block",":",":","python","agent.train","(",")","#","default","setting","assert","(","agent.training","is","True",")","agent.eval","(",")","assert","(","agent.training","is","False",")"]
code: def train(self):
      """Sets the agent in training mode, which is the default setting.
      Model of agent will be affected if it has some modules (e.g. Dropout, BatchNorm) that behave differently in train/evaluation mode.
  
      Example:
  
      .. code-block:: python
  
          agent.train()   # default setting
          assert (agent.training is True)
          agent.eval()
          assert (agent.training is False)
  
      """
      self.alg.model.train()
      self.training = True
  
file_path: PARL/parl/core/paddle/agent.py
imports: import os
  import paddle
  from paddle.static import InputSpec
  from parl.core.agent_base import AgentBase
  from parl.core.paddle.algorithm import Algorithm
label_desc: Use image node_id 8 for calling the Agent obj's underlying member method code with example usage: obj.train() without return types