Details of the changes:
- In the Python API of tensorflow, Const ops are created by calling
`_create_op_internal()` from constant_op.py. This differs from how most other ops
are created, and is similar to Placeholder ops, which are already instrumented
by tfdbg2' op_callbacks. In this CL, we add a op_callback hook to the code in
constant_op.py to allow instrumentation of Const ops.
that makes that call.
- In `_ConstantValue()` in tensor_util.py, add a special case for `CheckNumericsV2` op,
so the `constant_value()` does not treat the `CheckNumericsV2` op as the constant
tensor value. Similarly, add special cases for `Identity` and `DebugIdentityV2`.
- In `dumping_callback_test.py`, replace use of a deprecated Dataset API
(`make_one_shot_iterator()`) with non-deprecated API (`iter()` and `next()`)
- Make other necessary changes to tfdbg2's tests to accommodate the Const ops
which were previously not instrumented, but are now.
- Increase the shard_count of learning/brain/python/debug/tpu_callbacks_test.py to 6
to avoid timeouts under the instrumented number of instrumented ops.
PiperOrigin-RevId: 307723353
Change-Id: Iecdbfcb439f6e04fc12c1503ad5339d42703e8bc
Details of the changes:
- In the Python API of tensorflow, Const ops are created by calling
`_create_op_internal()` from constant_op.py. This differs from how most other ops
are created, and is similar to Placeholder ops, which are already instrumented
by tfdbg2' op_callbacks. In this CL, we add a op_callback hook to the code in
constant_op.py to allow instrumentation of Const ops.
that makes that call.
- In `_ConstantValue()` in tensor_util.py, add a special case for `CheckNumericsV2` op,
so the `constant_value()` does not treat the `CheckNumericsV2` op as the constant
tensor value. Similarly, add special cases for `Identity` and `DebugIdentityV2`.
- In `dumping_callback_test.py`, replace use of a deprecated Dataset API
(`make_one_shot_iterator()`) with non-deprecated API (`iter()` and `next()`)
- Make other necessary changes to tfdbg2's tests to accommodate the Const ops
which were previously not instrumented, but are now.
- Increase the shard_count of learning/brain/python/debug/tpu_callbacks_test.py to 6
to avoid timeouts under the instrumented number of instrumented ops.
PiperOrigin-RevId: 306165790
Change-Id: I366479e2c42648e52be9514864379cc5454e466c
Depending on the specifics of the condition (in particular whether it
can be evaluated statically), the error message produced by an assertion
can either be shown on one line or split across multiple lines.
In the latter case, the use of a .* regex fails, because the . doesn't
match the line breaks. To fix that we can just use [\s\S]* instead.
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
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: 212766976
This change brings the kernel implementation in sync with the shape function.
Prior to this change, when executing eagerly, for example with:
import tensorflow as tf
tf.enable_eager_execution()
print(tf.expand_dims(1, axis=[0, 1]))
the operation would succeed (because the kernel was effectively considering
axis=0). However, the same line (tf.expand_dims(1, axis=[0, 1])) would fail
in graph construction since the shape function for the ExpandDims operation
required a scalar.
This change addresses this one discrepancy, but there are likely more and
a more comprehensive approach will still need some figuring out.
PiperOrigin-RevId: 208755018