class_docstr: Computes the violations of a certain constraint.
class_docstr_tok: ["Computes","the","violations","of","a","certain","constraint","."]
docstr: Update the constraint violations metric.
  
  Args:
    trajectory: A tf_agents.trajectory.Trajectory
  
  Returns:
    The arguments, for easy chaining.
docstr_tok: ["Update","the","constraint","violations","metric",".","Args",":","trajectory",":","A","tf_agents.trajectory.Trajectory","Returns",":","The","arguments",",","for","easy","chaining","."]
code: def call(self, trajectory):
      """Update the constraint violations metric.
  
      Args:
        trajectory: A tf_agents.trajectory.Trajectory
  
      Returns:
        The arguments, for easy chaining.
      """
      feasibility_prob_all_actions = self._constraint(
          trajectory.observation
      )
      feasibility_prob_selected_actions = common.index_with_actions(
          feasibility_prob_all_actions,
          tf.cast(trajectory.action, dtype=tf.int32),
      )
      self.constraint_violations.assign(
          tf.reduce_mean(1.0 - feasibility_prob_selected_actions)
      )
      return trajectory
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Callable, Optional, Text
  import gin
  import tensorflow
  from tf_agents.bandits.policies import constraints
  from tf_agents.bandits.specs import utils
  from tf_agents.metrics import tf_metric
  from tf_agents.typing import types
  from tf_agents.utils import common
label_desc: Use image node_id 2 for calling the ConstraintViolationsMetric obj's underlying member method code with example usage: obj.call(trajectory) and returns: trajectory