garage.tf.q_functions.discrete_mlp_q_function module¶
Discrete MLP QFunction.
-
class
DiscreteMLPQFunction
(env_spec, name=None, hidden_sizes=(32, 32), hidden_nonlinearity=<function relu>, hidden_w_init=<tensorflow.python.ops.init_ops.GlorotUniform object>, hidden_b_init=<tensorflow.python.ops.init_ops.Zeros object>, output_nonlinearity=None, output_w_init=<tensorflow.python.ops.init_ops.GlorotUniform object>, output_b_init=<tensorflow.python.ops.init_ops.Zeros object>, dueling=False, layer_normalization=False)[source]¶ Bases:
garage.tf.q_functions.base.QFunction
Discrete MLP Q Function.
This class implements a Q-value network. It predicts Q-value based on the input state and action. It uses an MLP to fit the function Q(s, a).
Parameters: - env_spec (garage.envs.env_spec.EnvSpec) – Environment specification.
- name (str) – Name of the q-function, also serves as the variable scope.
- hidden_sizes (list[int]) – Output dimension of dense layer(s). For example, (32, 32) means the MLP of this q-function consists of two hidden layers, each with 32 hidden units.
- hidden_nonlinearity (callable) – Activation function for intermediate dense layer(s). It should return a tf.Tensor. Set it to None to maintain a linear activation.
- hidden_w_init (callable) – Initializer function for the weight of intermediate dense layer(s). The function should return a tf.Tensor.
- hidden_b_init (callable) – Initializer function for the bias of intermediate dense layer(s). The function should return a tf.Tensor.
- output_nonlinearity (callable) – Activation function for output dense layer. It should return a tf.Tensor. Set it to None to maintain a linear activation.
- output_w_init (callable) – Initializer function for the weight of output dense layer(s). The function should return a tf.Tensor.
- output_b_init (callable) – Initializer function for the bias of output dense layer(s). The function should return a tf.Tensor.
- layer_normalization (bool) – Bool for using layer normalization.
-
clone
(name)[source]¶ Return a clone of the Q-function.
It only copies the configuration of the Q-function, not the parameters.
Parameters: name (str) – Name of the newly created q-function.
-
get_qval_sym
(state_input, name)[source]¶ Symbolic graph for q-network.
Parameters: - state_input (tf.Tensor) – The state input tf.Tensor to the network.
- name (str) – Network variable scope.
Returns: The tf.Tensor output of Discrete MLP QFunction.
-
input
¶ Get input.
-
q_vals
¶ Return the Q values, the output of the network.