mirror of
https://github.com/wassname/ray.git
synced 2026-08-04 13:14:14 +08:00
[rllib] Better document which methods are abstract and which ones are overrides (#3480)
This commit is contained in:
@@ -82,19 +82,6 @@ class Model(object):
|
||||
self.outputs = tf.concat(
|
||||
[self.outputs, 0.0 * self.outputs + log_std], 1)
|
||||
|
||||
def _validate_output_shape(self):
|
||||
"""Checks that the model has the correct number of outputs."""
|
||||
try:
|
||||
out = tf.convert_to_tensor(self.outputs)
|
||||
shape = out.shape.as_list()
|
||||
except Exception:
|
||||
raise ValueError("Output is not a tensor: {}".format(self.outputs))
|
||||
else:
|
||||
if len(shape) != 2 or shape[1] != self._num_outputs:
|
||||
raise ValueError(
|
||||
"Expected output shape of [None, {}], got {}".format(
|
||||
self._num_outputs, shape))
|
||||
|
||||
def _build_layers(self, inputs, num_outputs, options):
|
||||
"""Builds and returns the output and last layer of the network.
|
||||
|
||||
@@ -159,6 +146,19 @@ class Model(object):
|
||||
"""
|
||||
return tf.constant(0.0)
|
||||
|
||||
def _validate_output_shape(self):
|
||||
"""Checks that the model has the correct number of outputs."""
|
||||
try:
|
||||
out = tf.convert_to_tensor(self.outputs)
|
||||
shape = out.shape.as_list()
|
||||
except Exception:
|
||||
raise ValueError("Output is not a tensor: {}".format(self.outputs))
|
||||
else:
|
||||
if len(shape) != 2 or shape[1] != self._num_outputs:
|
||||
raise ValueError(
|
||||
"Expected output shape of [None, {}], got {}".format(
|
||||
self._num_outputs, shape))
|
||||
|
||||
|
||||
def _restore_original_dimensions(input_dict, obs_space):
|
||||
if hasattr(obs_space, "original_space"):
|
||||
|
||||
Reference in New Issue
Block a user