contrib.distributions.RegisterKL

tf.contrib.distributions.RegisterKL

class tf.contrib.distributions.RegisterKL

Defined in tensorflow/python/ops/distributions/kullback_leibler.py.

See the guide: Statistical Distributions (contrib) > Kullback-Leibler Divergence

Decorator to register a KL divergence implementation function.

Usage:

@distributions.RegisterKL(distributions.Normal, distributions.Normal) def _kl_normal_mvn(norm_a, norm_b): # Return KL(norm_a || norm_b)

Methods

__init__

__init__(
    dist_cls_a,
    dist_cls_b
)

Initialize the KL registrar.

Args:

  • dist_cls_a: the class of the first argument of the KL divergence.
  • dist_cls_b: the class of the second argument of the KL divergence.

__call__

__call__(kl_fn)

Perform the KL registration.

Args:

  • kl_fn: The function to use for the KL divergence.

Returns:

kl_fn

Raises:

  • TypeError: if kl_fn is not a callable.
  • ValueError: if a KL divergence function has already been registered for the given argument classes.

© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/distributions/RegisterKL

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部