BREAKING_CHANGE: Remove event_ndims in Bijector, and require `log_det_jacobian` metho...
authorA. Unique TensorFlower <gardener@tensorflow.org>
Wed, 11 Apr 2018 21:02:49 +0000 (14:02 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Wed, 11 Apr 2018 21:05:19 +0000 (14:05 -0700)
commiteed6828acf19260279b38a7fbaf79141c813f795
tree2557e50c269580148b4ebe02514c863bb6d53960
parent1e283d64816b92de6c398bee6df2122409c87d73
BREAKING_CHANGE: Remove event_ndims in Bijector, and require `log_det_jacobian` methods to take event_ndims.

The class level event_ndims parameter is being deprecated in favor of passing it in
to the `log_det_jacobian` methods.

Specific changes:

  - `log_det_jacobian` signatures are now `log_det_jacobian(input, event_ndims)`

  - Constructors no long have event_ndims passed in (e.g. Affine() vs. Affine(event_ndims=0)).

  - All bijectors must specify a subset of [forward_min_event_ndims, inverse_min_event_ndims]. This is the minimal dimensionality the bijector operates on, with it being "broadcasted" to any passed in event_ndims (e.g. Exp has forward_min_event_ndims = 0. That means it operates on scalars. However, we can use the bijector on any event_ndims > 0 (i.e. we've broadcasted the transformation to work on any amount of event_ndims > 0), and jacobian reduction will work in those cases.

As a result of this change, all bijectors should "broadcast" (e.g. Sigmoid now works on any number of event_ndims).

Other changes (internal and documentation):
  - Added clarifications on Jacobian Determinant vs. Jacobian Matrix.
  - Added clarifications on min_event_ndims, and what the jacobian reduction is over.
  - Changed caching of ildj to be keyed on event_ndims.
  - Several bug fixes to bugs unearthed while writing this code (e.g. transformed distribution shape computation being incorrect)

PiperOrigin-RevId: 192504919
70 files changed:
tensorflow/contrib/distributions/python/kernel_tests/bijectors/absolute_value_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/affine_linear_operator_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/affine_scalar_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/affine_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/batch_normalization_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/chain_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/cholesky_outer_product_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/conditional_bijector_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/exp_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/gumbel_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/inline_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/invert_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/kumaraswamy_bijector_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/masked_autoregressive_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/permute_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/power_transform_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/real_nvp_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/reshape_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/sigmoid_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/sinh_arcsinh_bijector_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/softmax_centered_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/softplus_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/square_test.py
tensorflow/contrib/distributions/python/kernel_tests/bijectors/weibull_test.py
tensorflow/contrib/distributions/python/kernel_tests/conditional_transformed_distribution_test.py
tensorflow/contrib/distributions/python/kernel_tests/mvn_diag_test.py
tensorflow/contrib/distributions/python/kernel_tests/transformed_distribution_test.py
tensorflow/contrib/distributions/python/kernel_tests/vector_laplace_diag_test.py
tensorflow/contrib/distributions/python/ops/bijectors/absolute_value.py
tensorflow/contrib/distributions/python/ops/bijectors/affine.py
tensorflow/contrib/distributions/python/ops/bijectors/affine_linear_operator.py
tensorflow/contrib/distributions/python/ops/bijectors/affine_scalar.py
tensorflow/contrib/distributions/python/ops/bijectors/batch_normalization.py
tensorflow/contrib/distributions/python/ops/bijectors/chain.py
tensorflow/contrib/distributions/python/ops/bijectors/cholesky_outer_product.py
tensorflow/contrib/distributions/python/ops/bijectors/conditional_bijector.py
tensorflow/contrib/distributions/python/ops/bijectors/exp.py
tensorflow/contrib/distributions/python/ops/bijectors/gumbel.py
tensorflow/contrib/distributions/python/ops/bijectors/inline.py
tensorflow/contrib/distributions/python/ops/bijectors/invert.py
tensorflow/contrib/distributions/python/ops/bijectors/kumaraswamy.py
tensorflow/contrib/distributions/python/ops/bijectors/masked_autoregressive.py
tensorflow/contrib/distributions/python/ops/bijectors/permute.py
tensorflow/contrib/distributions/python/ops/bijectors/power_transform.py
tensorflow/contrib/distributions/python/ops/bijectors/real_nvp.py
tensorflow/contrib/distributions/python/ops/bijectors/reshape.py
tensorflow/contrib/distributions/python/ops/bijectors/sigmoid.py
tensorflow/contrib/distributions/python/ops/bijectors/sinh_arcsinh.py
tensorflow/contrib/distributions/python/ops/bijectors/softmax_centered.py
tensorflow/contrib/distributions/python/ops/bijectors/softplus.py
tensorflow/contrib/distributions/python/ops/bijectors/square.py
tensorflow/contrib/distributions/python/ops/bijectors/weibull.py
tensorflow/contrib/distributions/python/ops/conditional_transformed_distribution.py
tensorflow/contrib/distributions/python/ops/poisson_lognormal.py
tensorflow/contrib/distributions/python/ops/relaxed_onehot_categorical.py
tensorflow/contrib/distributions/python/ops/sinh_arcsinh.py
tensorflow/contrib/distributions/python/ops/vector_diffeomixture.py
tensorflow/contrib/distributions/python/ops/vector_sinh_arcsinh_diag.py
tensorflow/python/kernel_tests/distributions/bijector_test.py
tensorflow/python/kernel_tests/distributions/identity_bijector_test.py
tensorflow/python/ops/distributions/bijector_impl.py
tensorflow/python/ops/distributions/bijector_test_util.py
tensorflow/python/ops/distributions/bijectors.py [deleted file]
tensorflow/python/ops/distributions/distributions.py
tensorflow/python/ops/distributions/identity_bijector.py
tensorflow/python/ops/distributions/transformed_distribution.py
tensorflow/tools/api/golden/tensorflow.distributions.bijectors.-bijector.pbtxt [deleted file]
tensorflow/tools/api/golden/tensorflow.distributions.bijectors.-identity.pbtxt [deleted file]
tensorflow/tools/api/golden/tensorflow.distributions.bijectors.pbtxt [deleted file]
tensorflow/tools/api/golden/tensorflow.distributions.pbtxt