mirror of
https://github.com/wassname/ray.git
synced 2026-07-14 11:17:54 +08:00
[rllib] Pull out shared models for evolution strategies and policy gradient. (#719)
* wip * works with cartpole * lint * fix pg * comment * action dist rename * preprocessor * fix test * typo * fix the action[0] nonsense * revert * satisfy the lint * wip * works with cartpole * lint * fix pg * comment * action dist rename * preprocessor * fix test * typo * fix the action[0] nonsense * revert * satisfy the lint * Minor indentation changes. * fix merge * add humanoid * fix linting * more 4 space * fix * fix linT * oops * es parity
This commit is contained in:
committed by
Philipp Moritz
parent
8fc7dc3ed4
commit
420013774c
@@ -0,0 +1,28 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
class Model(object):
|
||||
"""Defines an abstract network model for use with RLlib.
|
||||
|
||||
Models convert input tensors to a number of output features. These features
|
||||
can then be interpreted by ActionDistribution classes to determine
|
||||
e.g. agent action values.
|
||||
"""
|
||||
|
||||
def __init__(self, inputs, num_outputs):
|
||||
self.inputs = inputs
|
||||
self.outputs = self._init(inputs, num_outputs)
|
||||
|
||||
def _init(self):
|
||||
"""Initializes the model given self.inputs and self.num_outputs."""
|
||||
raise NotImplementedError
|
||||
|
||||
def inputs(self):
|
||||
"""Returns the input placeholder for this model."""
|
||||
return self.inputs
|
||||
|
||||
def outputs(self):
|
||||
"""Returns the output tensor of this model."""
|
||||
return self.outputs
|
||||
Reference in New Issue
Block a user