class_docstr: Assigns the `update_kl()` method to a TorchPolicy.
  
  This is used by Algorithms to update the KL coefficient
  after each learning step based on `config.kl_target` and
  the measured KL value (from the train_batch).
class_docstr_tok: ["Assigns","the","`","update_kl","(",")","`","method","to","a","TorchPolicy",".","This","is","used","by","Algorithms","to","update","the","KL","coefficient","after","each","learning","step","based","on","`","config.kl_target","`","and","the","measured","KL","value","(","from","the","train_batch",")","."]
code: def update_kl(self, sampled_kl):
      # Update the current KL value based on the recently measured value.
      if sampled_kl > 2.0 * self.kl_target:
          self.kl_coeff *= 1.5
      elif sampled_kl < 0.5 * self.kl_target:
          self.kl_coeff *= 0.5
      # Return the current KL value.
      return self.kl_coeff
  
imports: from ray.rllib.policy.policy import Policy, PolicyState
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.policy.torch_policy import TorchPolicy
  from ray.rllib.utils.annotations import DeveloperAPI, override
  from ray.rllib.utils.framework import try_import_torch
  from ray.rllib.utils.schedules import PiecewiseSchedule
label_desc: Use image node_id 2 for calling the KLCoeffMixin obj's underlying member method code with example usage: obj.update_kl(sampled_kl) and returns: self