class_docstr: | `alias`: ``parl.Model``
  | `alias`: ``parl.core.fluid.agent.Model``
  
  | ``Model`` is a base class of PARL for the neural network. A ``Model`` is usually a policy or Q-value function, which predicts an action or an estimate according to the environmental observation.
  
  | To track all the layers , users are required to implement neural networks with the layers from ``parl.layers`` (e.g., parl.layers.fc). These layers has the same APIs as fluid.layers.
  
  | ``Model`` supports duplicating a ``Model`` instance in a pythonic way:
  
  | ``copied_model = copy.deepcopy(model)``
  
  Example:
  
  .. code-block:: python
  
      import parl
  
      class Policy(parl.Model):
          def __init__(self):
              self.fc = parl.layers.fc(size=12, act='softmax')
  
          def policy(self, obs):
              out = self.fc(obs)
              return out
             
      policy = Policy() 
      copied_policy = copy.deepcopy(model)
  
  Attributes:
      model_id(str): each model instance has its unique model_id.
  
  Public Functions:
      - ``sync_weights_to``: synchronize parameters of the current model to another model.
      - ``get_weights``: return a list containing all the parameters of the current model.
      - ``set_weights``: copy parameters from ``set_weights()`` to the model.
      - ``forward``: define the computations of a neural network. **Should** be overridden by all subclasses.
      - ``parameters``: return a list containting names of parameters of the model. 
      - ``set_model_id``: set ``model_id`` of current model explicitly.
      - ``get_model_id``: return the ``model_id`` of current model.
class_docstr_tok: ["|","`","alias","`",":","``","parl.Model","``","|","`","alias","`",":","``","parl.core.fluid.agent.Model","``","|","``","Model","``","is","a","base","class","of","PARL","for","the","neural","network",".","A","``","Model","``","is","usually","a","policy","or","Q-value","function",",","which","predicts","an","action","or","an","estimate","according","to","the","environmental","observation",".","|","To","track","all","the","layers",",","users","are","required","to","implement","neural","networks","with","the","layers","from","``","parl.layers","``","(","e.g.",",","parl.layers.fc",")",".","These","layers","has","the","same","APIs","as","fluid.layers",".","|","``","Model","``","supports","duplicating","a","``","Model","``","instance","in","a","pythonic","way",":","|","``","copied_model","=","copy.deepcopy","(","model",")","``","Example",":","..","code-block",":",":","python","import","parl","class","Policy","(","parl.Model",")",":","def","__init__","(","self",")",":","self.fc","=","parl.layers.fc","(","size=12",",","act='softmax","'",")","def","policy","(","self",",","obs",")",":","out","=","self.fc","(","obs",")","return","out","policy","=","Policy","(",")","copied_policy","=","copy.deepcopy","(","model",")","Attributes",":","model_id","(","str",")",":","each","model","instance","has","its","unique","model_id",".","Public","Functions",":","-","``","sync_weights_to","``",":","synchronize","parameters","of","the","current","model","to","another","model",".","-","``","get_weights","``",":","return","a","list","containing","all","the","parameters","of","the","current","model",".","-","``","set_weights","``",":","copy","parameters","from","``","set_weights","(",")","``","to","the","model",".","-","``","forward","``",":","define","the","computations","of","a","neural","network",".","*","*","Should","*","*","be","overridden","by","all","subclasses",".","-","``","parameters","``",":","return","a","list","containting","names","of","parameters","of","the","model",".","-","``","set_model_id","``",":","set","``","model_id","``","of","current","model","explicitly",".","-","``","get_model_id","``",":","return","the","``","model_id","``","of","current","model","."]
docstr: Copy parameters from ``set_weights()`` to the model.
  
  Args:
      weights (list): a Python list containing the parameters.
docstr_tok: ["Copy","parameters","from","``","set_weights","(",")","``","to","the","model",".","Args",":","weights","(","list",")",":","a","Python","list","containing","the","parameters","."]
code: def set_weights(self, weights):
      """Copy parameters from ``set_weights()`` to the model.
  
      Args:
          weights (list): a Python list containing the parameters.
      """
      assert len(weights) == len(
          self.parameters()
      ), "size of input weights should be same as weights number of current model"
      try:
          is_gpu_available = self._is_gpu_available
      except AttributeError:
          self._is_gpu_available = machine_info.is_gpu_available()
          is_gpu_available = self._is_gpu_available
  
      for param_name, weight in list(zip(self.parameters(), weights)):
          set_value(param_name, weight, is_gpu_available)
  
file_path: PARL/parl/core/fluid/model.py
imports: import hashlib
  import paddle.fluid
  from parl.core.fluid.layers.layer_wrappers import LayerFunc
  from parl.core.fluid.plutils import *
  from parl.core.model_base import ModelBase
  from parl.utils import machine_info
  from parl.core.fluid.model_helper import global_model_helper
label_desc: Use image node_id 9 for calling the Model obj's underlying member method code with example usage: obj.set_weights(weights) without return types