class_docstr: Class for representing a trainable relative quantile constraint.
  
  This constraint class implements a relative quantile constraint such as
  ```
  Q_tau(action) >= Q_tau(baseline_action)
  ```
  or
  ```
  Q_tau(action) <= Q_tau(baseline_action)
  ```
class_docstr_tok: ["Class","for","representing","a","trainable","relative","quantile","constraint",".","This","constraint","class","implements","a","relative","quantile","constraint","such","as","``","`","Q_tau","(","action",")",">","=","Q_tau","(","baseline_action",")","``","`","or","``","`","Q_tau","(","action",")","<","=","Q_tau","(","baseline_action",")","``","`"]
docstr: Creates a trainable relative quantile constraint using a neural network.
  
  Args:
    time_step_spec: A `TimeStep` spec of the expected time_steps.
    action_spec: A nest of `BoundedTensorSpec` representing the actions.
    constraint_network: An instance of `tf_agents.network.Network` used to
      provide estimates of action feasibility.  The input structure should be
      consistent with the `observation_spec`.
    quantile: A float between 0. and 1., the quantile we want to regress.
    comparator_fn: a comparator function, such as tf.greater or tf.less.
    baseline_action_fn: a callable that given the observation returns the
      baseline action. If None, the baseline action is set to 0.
    name: Python str name of this agent. All variables in this module will
      fall under that name. Defaults to the class name.
code: def __init__(
      self,
      time_step_spec: types.TimeStep,
      action_spec: types.BoundedTensorSpec,
      constraint_network: types.Network,
      quantile: float = 0.5,
      comparator_fn: types.ComparatorFn = tf.greater,
      baseline_action_fn: Optional[
          Callable[[types.Tensor], types.Tensor]
      ] = None,
      name: Text = "RelativeQuantileConstraint",
  ):
      """Creates a trainable relative quantile constraint using a neural network.
  
      Args:
        time_step_spec: A `TimeStep` spec of the expected time_steps.
        action_spec: A nest of `BoundedTensorSpec` representing the actions.
        constraint_network: An instance of `tf_agents.network.Network` used to
          provide estimates of action feasibility.  The input structure should be
          consistent with the `observation_spec`.
        quantile: A float between 0. and 1., the quantile we want to regress.
        comparator_fn: a comparator function, such as tf.greater or tf.less.
        baseline_action_fn: a callable that given the observation returns the
          baseline action. If None, the baseline action is set to 0.
        name: Python str name of this agent. All variables in this module will
          fall under that name. Defaults to the class name.
      """
      self._baseline_action_fn = baseline_action_fn
      self._comparator_fn = comparator_fn
      self._error_loss_fn = functools.partial(
          loss_utils.pinball_loss, quantile=quantile
      )
  
      super(RelativeQuantileConstraint, self).__init__(
          time_step_spec,
          action_spec,
          constraint_network,
          error_loss_fn=self._error_loss_fn,
          name=name,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import functools
  from typing import Callable, Iterable, Optional, Text
  import six
  import tensorflow
  import tensorflow_probability
  from tf_agents.bandits.policies import loss_utils
  from tf_agents.bandits.specs import utils
  from tf_agents.policies import utils
  from tf_agents.trajectories import time_step
  from tf_agents.typing import types
  from tf_agents.utils import common
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 1 to create a new RelativeQuantileConstraint object from inherited base classes: NeuralConstraint with example: obj = RelativeQuantileConstraint(time_step_spec, action_spec, constraint_network, quantile, comparator_fn, baseline_action_fn, name)