Repository navigation
[pull] master from tensorflow:master - #8848
Merged
Merged
Conversation
…/python Replace bare 'raise Exception(...)' with appropriate built-in exception types across several modules in tensorflow/python/: - tensorflow/python/tools/selective_registration_header_lib.py: Exception -> ValueError (empty input file) - tensorflow/python/platform/benchmark.py: Exception -> ValueError (duplicate benchmark name) - tensorflow/python/tpu/client/client.py: Exception -> RuntimeError (TPU version not available, worker configuration failure) - tensorflow/python/keras/utils/data_utils.py: Exception -> OSError (URL fetch failures wrapping urllib HTTP/URL errors) - tensorflow/python/ops/numpy_ops/tests/config.py: Exception -> KeyError (unrecognized config option) Exception -> ValueError (duplicate config definition) Using specific exception types follows Python best practices (PEP 8) and allows callers to catch and handle errors more precisely.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Refactor error handling in TPU client for clarity.
…dAccumulator When computing second-order derivatives via nested tf.autodiff.ForwardAccumulator (forward-over-forward), _CumulativeLogsumexpGrad suffered from two issues: 1. Transposing the VJP for forward-mode autodiff evaluates both branches of array_ops.where_v2. In the unselected branch where grad <= 0 (or grad >= 0), math_ops.log(0.0) evaluates to -inf, and differentiating a second time produces 0.0 * (1.0 / 0.0) = 0.0 * inf = NaN in _LogGrad. Guarding the log argument with a double-where pattern (safe_pos_grad / safe_neg_grad) and subtracting cumulative_logsumexp inside the where branch prevents log(0) and (-inf) - (-inf) = NaN when exclusive=True. 2. Under nested ForwardAccumulator execution, inner JVP callbacks execute before outer JVP callbacks attach outer tangents to op.outputs[0]. Recomputing cumulative_logsumexp from op.inputs[0] ensures outer tangents are tracked. Fixes #127243
Ensure tf.math.log_sigmoid preserves small finite second-derivative signals for float64 inputs without prematurely collapsing to 0.0 due to cancellation. Also update log_sigmoid docstring to document support for float16 and bfloat16. Fixes #126628
… keras-team/keras, cannot merge via tensorflow/tensorflow Drops tensorflow/python/keras/utils/data_utils.py from PR #117860 so only 4 core files remain. Keras fix will be submitted separately upstream.
Add safety check before deleting buffer in destructor.
Refactor __del__ method to safely access buffer attribute and delete it if necessary.
Removed unnecessary sys import and Python 2 compatibility check.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
`tf.experimental.numpy.sinc` evaluates `sin(pi_x) / pi_x` and selects away from it at `x == 0` with `where`. That discarded branch is 0/0 there, and `where` still propagates its gradient (0 * nan is nan), so the gradient at zero came out as `nan` instead of `0`. Substituting 1 for the denominator in the discarded branch leaves the forward values bit-for-bit identical (the branch is never selected) while making it finite, so its contribution is scaled to exactly 0. Adds a regression test that fails before the change and passes after. Related: #127226
…ent exclusions 1. Replace array_ops.ones_like(grad) with math_ops.cast(1.0, grad.dtype) in _CumulativeLogsumexpGrad to avoid allocating full-shape ones tensors. 2. Regenerate tensorflow/python/eager/pywrap_gradient_exclusions.cc to add CumulativeLogsumexp to OpGradientUnusedOutputIndices since op.outputs[0] is no longer read by _CumulativeLogsumexpGrad.
Per gemini-code-assist review on #127742: x_np is always float64, so casting the expected array to x_np.dtype compared a float64 reference against the float32 gradient under assertAllClose. Casting to dtype.as_numpy_dtype keeps the precision strict for every tested dtype.
Use atol=1e-18 instead of 0 in testLogSigmoidSecondDerivativePreservesSmallValue to ensure stability across different hardware architectures and precisions.
Reverts changelist 986346565 PiperOrigin-RevId: 986414211
The HLO to StableHLO import of a sub byte integer constant recomputed `literal.element_count()` and pushed back one byte per element. The export read one APInt per element and set the literal one multidimensional index at a time. Both now copy the elements in bulk with unchanged per element semantics, so large int4 constants no longer dominate the round trip. Splats fill the literal with one std::fill. Compiled output is unchanged. PiperOrigin-RevId: 986444398
…alDmaBenchmarks. PiperOrigin-RevId: 986475694
PiperOrigin-RevId: 986481082
PiperOrigin-RevId: 986481086
…-inline PiperOrigin-RevId: 986483257
PiperOrigin-RevId: 986483313
PiperOrigin-RevId: 986484521
…umexp-nested-jvp PiperOrigin-RevId: 986485736
PiperOrigin-RevId: 986485775
PiperOrigin-RevId: 986486141
PiperOrigin-RevId: 986493151
…ivative PiperOrigin-RevId: 986494249
PiperOrigin-RevId: 986508500
Blocking on the destructor has a performance implication. We actually don't need to block on the destructor since the watchdog can be disarmed asynchronously inside a host callback. PiperOrigin-RevId: 986518654
PiperOrigin-RevId: 986524446
PiperOrigin-RevId: 986531011
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )