An implementation involving continued fractions is used. The continued fraction
for this function can be seen at http://dlmf.nist.gov/8.17.v
PiperOrigin-RevId: 277327138
Change-Id: Icb8527af344b629806fd7e4880072d05e2530cd2
Some test methods are disabled, but all tests now have a new "_xla" version of the test for XLA:GPU testing. This will run 2 different tests. One with XLA and one without.
PiperOrigin-RevId: 229149574
Skip individual test cases or entire suites that are not
running in v1. Also replace some @run_deprecated_v1
annotations since simply running the test in graph mode
was not enough.
PiperOrigin-RevId: 224604547
In order to support tests running in eager mode we need to avoid
unnecessary use of Sessions in tests. This moves to remove some
of the uses of the `run` function in favor of `evaluate`.
PiperOrigin-RevId: 223009795
In order to support tests running in eager mode we need to avoid
unnecessary use of Sessions in tests. This moves to remove some
of the uses of the `run` function in favor of `evaluate`.
PiperOrigin-RevId: 222013881
In order to get tests running in eager mode we need to remove invalid
functions calls such as eval(). This change is simply a search and
replace for tests where this was safe. As a result, a few more tests now
work in eager mode.
PiperOrigin-RevId: 221836866
Move to cached_session() if the session is create more than once per test. Move to session() otherwise.
self.test_session() has been deprecated in 9962eb5e84 as its name confuses readers of the test. Moving to session() instead which slightly changes the semantic of the function:
* the session is not cached anymore (a new session is created).
* the session is closed when exiting the "with" scope.
PiperOrigin-RevId: 216868101
After this change, you could conceivably write tfd.Normal(0., 1.).log_prob(1)
The tf core distributions can't use tfp dtype_util.common_dtype, so you can't yet write tfd.Normal(0, 1).
Works around an eager bug that loses precision in the presence in tf.convert_to_tensor(0.5, preferred_dtype=tf.int32)
PiperOrigin-RevId: 214666222
- Remove unnecessary test_session() boilerplate when executing eagerly
- Use self.cached_session() instead of self.test_session() when using graphs
self.test_session() has been deprecated in 9962eb5e84 as its name confuses readers of the test. Moving to cached_session() instead which is more explicit about:
* the fact that the session may be reused.
* the session is not closed even when doing a "with self.test_session()" statement.
PiperOrigin-RevId: 211542360
self -> _parameters -> self cycles were creating work for Python's garbage collector in training loops, where Distribution objects may be created repeatedly when executing eagerly. This CL just fixes that narrow memory issue; I'm not convinced dict(locals()) is super efficient, so we may want to follow up on that for performance.
Adds a few unit tests tests with run_test_in_graph_and_eager_modes(assert_no_eager_garbage=True). It'd be nice to expand this coverage over time.
Includes a small test_util simplification to support this (TFP tests don't like reset_default_graph for some reason). Testing for cycles in the TFP repo will need to wait on the Normal changes from the TF repo syncing.
PiperOrigin-RevId: 211520394
self.test_session() has been deprecated in 9962eb5e84 as its name confuses readers of the test. Moving to cached_session() instead which is more explicit about:
* the fact that the session may be reused.
* the session is not closed even when doing a "with self.test_session()" statement.
PiperOrigin-RevId: 209839030
For every distribution, the changes are:
* Set reparameterization_type to FULLY_REPARAMETERIZED.
* Add a note about reparameterization and an example to the docstring.
* Add a test that ensures that the gradients exist.
Additional changes:
* Fix docstring and test in TFP that assume that Gamma is not reparameterized. We simply replace Gamma with Bernoulli :)
* Fix paths to modules in docstrings.
PiperOrigin-RevId: 201691205
Take samples from the distribution and differentiate the samples wrt the parameters. If the distribution is not reparameterized, the gradients should be None. Otherwise, they should not be None.
PiperOrigin-RevId: 201502156
# Lower triangular matrix
x = tf.matrix_band_part(x, -1, 0)
x == fill_triangular(fill_triangular_inverse(x))
Code by srvasude@ which I'm submitting on his behalf.
PiperOrigin-RevId: 198623887
Revert #18413. Too many internal test failures due to the name scope change caused by this change.
Revert #18192. Cannot use re2::StringPiece internally. Need alternative for set call. Will pull and clean this up in a separate change.
PiperOrigin-RevId: 197991247