bits_per_dimension

tfsnippet.ops.bits_per_dimension(log_p, value_size, scale=256.0, name=None)

Compute “bits per dimension” of x.

BPD(x) = - log(p(x)) / (log(2) * Dim(x))

If u = s * x, then:

BPD(x) = - (log(p(u)) - log(s) * Dim(x)) / (log(2) * Dim(x))

Parameters:
  • log_p (Tensor) – If scale is specified, then it should be log(p(u)). Otherwise it should be log(p(x)).
  • value_size (int or Tensor) – The size of each x, i.e., Dim(x).
  • scale (float or Tensor or None) – The scale s, where u = s * x, and log_p is log(p(u)).
Returns:

The computed “bits per dimension” of x.

Return type:

tf.Tensor