class_docstr: Computes Kullback-Leibler divergence metric between `y_true` and
  `y_pred`.
  
  Formula:
  
  ```python
  metric = y_true * log(y_true / y_pred)
  ```
  
  Args:
      name: (Optional) string name of the metric instance.
      dtype: (Optional) data type of the metric result.
  
  Standalone usage:
  
  >>> m = keras.metrics.KLDivergence()
  >>> m.update_state([[0, 1], [0, 0]], [[0.6, 0.4], [0.4, 0.6]])
  >>> m.result()
  0.45814306
  
  >>> m.reset_state()
  >>> m.update_state([[0, 1], [0, 0]], [[0.6, 0.4], [0.4, 0.6]],
  ...                sample_weight=[1, 0])
  >>> m.result()
  0.9162892
  
  Usage with `compile()` API:
  
  ```python
  model.compile(optimizer='sgd',
                loss='mse',
                metrics=[keras.metrics.KLDivergence()])
  ```
class_docstr_tok: ["Computes","Kullback-Leibler","divergence","metric","between","`","y_true","`","and","`","y_pred","`",".","Formula",":","``","`","python","metric","=","y_true","*","log","(","y_true","\/","y_pred",")","``","`","Args",":","name",":","(","Optional",")","string","name","of","the","metric","instance",".","dtype",":","(","Optional",")","data","type","of","the","metric","result",".","Standalone","usage",":",">",">",">","m","=","keras.metrics.KLDivergence","(",")",">",">",">","m.update_state","(","[","[","0",",","1","]",",","[","0",",","0","]","]",",","[","[","0.6",",","0.4","]",",","[","0.4",",","0.6","]","]",")",">",">",">","m.result","(",")","0.45814306",">",">",">","m.reset_state","(",")",">",">",">","m.update_state","(","[","[","0",",","1","]",",","[","0",",","0","]","]",",","[","[","0.6",",","0.4","]",",","[","0.4",",","0.6","]","]",",","...","sample_weight=","[","1",",","0","]",")",">",">",">","m.result","(",")","0.9162892","Usage","with","`","compile","(",")","`","API",":","``","`","python","model.compile","(","optimizer='sgd","'",",","loss='mse","'",",","metrics=","[","keras.metrics.KLDivergence","(",")","]",")","``","`"]
code: def __init__(self, name="kl_divergence", dtype=None):
      super().__init__(fn=kl_divergence, name=name, dtype=dtype)
  
imports: from keras.api_export import keras_export
  from keras.losses.losses import binary_crossentropy
  from keras.losses.losses import categorical_crossentropy
  from keras.losses.losses import kl_divergence
  from keras.losses.losses import poisson
  from keras.losses.losses import sparse_categorical_crossentropy
  from keras.metrics import reduction_metrics
label_desc: Use image node_id 1 to create a new KLDivergence object from inherited base classes: reduction_metrics with example: obj = KLDivergence(name, dtype)