ray.rllib.models.tf.tf_modelv2.TFModelV2
ray.rllib.models.tf.tf_modelv2.TFModelV2#
- class ray.rllib.models.tf.tf_modelv2.TFModelV2(obs_space: <MagicMock name='mock.spaces.Space' id='140494124151808'>, action_space: <MagicMock name='mock.spaces.Space' id='140494124151808'>, num_outputs: int, model_config: dict, name: str)[source]#
Bases:
ray.rllib.models.modelv2.ModelV2TF version of ModelV2, which should contain a tf keras Model.
Note that this class by itself is not a valid model unless you implement forward() in a subclass.
Methods
__init__(obs_space, action_space, ...)Initializes a TFModelV2 instance.
context()Returns a contextmanager for the current TF graph.
custom_loss(policy_loss, loss_inputs)Override to customize the loss function used to optimize this model.
forward(input_dict, state, seq_lens)Call the model with the given input tensors and state.
Get the initial recurrent state values for the model.
import_from_h5(h5_file)Imports weights from an h5 file.
If True, data for calling this ModelV2 must be in time-major format.
Returns the last output returned from calling the model.
metrics()Override to return custom metrics from your model.
register_variables(variables)Register the given list of variables with this model.
Return the list of update ops for this model.
Returns the value function output for the most recent forward pass.