Commit Graph

28 Commits

Author SHA1 Message Date
ngc92
4b265f2022 Merge remote-tracking branch 'upstream/master' into constant_from_identity
# Conflicts:
#	tensorflow/python/framework/tensor_util.py
#	tensorflow/python/kernel_tests/confusion_matrix_test.py
2020-04-22 20:02:22 +03:00
ngc92
31077fffee test fixes? 2020-04-22 14:23:52 +03:00
Shanqing Cai
e6f22ee5f4 [tfdbg2] Ensure Const ops in graphs are captured by op_callbacks
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
2020-04-21 18:42:31 -07:00
A. Unique TensorFlower
cd153446ee Internal change
PiperOrigin-RevId: 306166861
Change-Id: I24f36a98ff77d578f58aa56f62a96cce1da90e7b
2020-04-12 19:56:56 -07:00
Shanqing Cai
4e45372967 [tfdbg2] Ensure Const ops in graphs are captured by op_callbacks
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
2020-04-12 19:37:56 -07:00
A. Unique TensorFlower
dd000bf022 Automated rollback of commit 7d1e428d00
PiperOrigin-RevId: 293172766
Change-Id: I8d500a3afe2871bf97210e9d27b115707cfa96f4
2020-02-04 10:16:58 -08:00
Mihai Maruseac
7d1e428d00 Automated rollback of commit 6cfa3be415.
PiperOrigin-RevId: 293159446
Change-Id: Ia259bdf433ae14f58e9400eba9c7e51b43a1ee10
2020-02-04 09:13:47 -08:00
Mihai Maruseac
6cfa3be415 Automated rollback of commit af844bd2df. Revert .
PiperOrigin-RevId: 293035126
Change-Id: I3792e56ce25e664fd9d3d41c9f4970e6a0b41b50
2020-02-03 16:51:01 -08:00
Harry Slatyer
0e59af232b Handle error messages with line breaks in confusion_matrix_test
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.
2020-01-08 09:24:38 +11:00
Zhenyu Tan
78abbf1682 Fix loss computation when y_true and y_pred is not same shape.
PiperOrigin-RevId: 267595602
2019-09-06 07:50:30 -07:00
Haoyu Zhang
acab8c311b Convert weights to tensor in confusion_matrix op, to be consistent with how tensor arguments are usually treated.
PiperOrigin-RevId: 235828431
2019-02-26 17:51:48 -08:00
TensorFlower Gardener
ed60e8209b Merge pull request from BoboTiG:fix-invalid-seq-warnings
PiperOrigin-RevId: 228216549
2019-01-07 13:43:00 -08:00
Mickaël Schoentgen
75f12a5020 Fix several DeprecationWarning: invlid escape sequence
Signed-off-by: Mickaël Schoentgen <contact@tiger-222.fr>
2019-01-03 22:36:43 +01:00
Gaurav Jain
24f578cd66 Add @run_deprecated_v1 annotation to tests failing in v2
PiperOrigin-RevId: 223422907
2018-11-29 15:43:25 -08:00
Gaurav Jain
4fe22bc9da Replace many calls to eval() with self.evaluate()
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
2018-11-16 13:10:31 -08:00
A. Unique TensorFlower
626bc997c2 Move from deprecated self.test_session() to self.cached_session().
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
2018-09-13 00:09:08 -07:00
Asim Shankar
94ba1c4f0e ExpandDims requires the 'dim' argument to be a scalar.
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
2018-08-14 19:05:11 -07:00
Tom Hennigan
945d1a77ae Replace unnecessary () in run_in_graph_and_eager_modes().
PiperOrigin-RevId: 201652888
2018-06-22 01:49:29 -07:00
Yifei Feng
22f3a97b8b Merge changes from github.
PiperOrigin-RevId: 194031845
2018-04-23 21:21:38 -07:00
Alexandre Passos
ba1c7b8c67 tf.confusion_matrix works with eager execution enabled.
PiperOrigin-RevId: 173188867
2017-10-23 16:38:54 -07:00
A. Unique TensorFlower
6ac3efd429 Assert when num_classes in confusion_matrix is too small instead of writing out-of-bounds (corrupting memory).
PiperOrigin-RevId: 158824146
2017-06-13 02:47:36 -07:00
A. Unique TensorFlower
91a6f2f4d6 Change weight broadcasting for losses.sparse_softmax_cross_entropy to be the same as sparse_softmax_cross_entropy_with_logits. This means allowing greater than rank 2 inputs.
Also, fix some pydoc.
Change: 144898465
2017-01-18 16:45:50 -08:00
A. Unique TensorFlower
4d9a24026c Transpose confusion matrix output to make it consistent with sklearn.
Change: 144356967
2017-01-12 12:44:48 -08:00
A. Unique TensorFlower
91685f833b Fix documentation of rows vs columns of confusion matrix.
Change: 144271336
2017-01-11 17:46:29 -08:00
A. Unique TensorFlower
0e226af7ee Switch tf.concat_v2 references in third_party/tensorflow to tf.concat.
Change: 144153795
2017-01-10 18:46:37 -08:00
Justine Tunney
5866e065bc Remove hourglass imports from kernel_tests
Change: 142080137
2016-12-14 16:43:13 -08:00
A. Unique TensorFlower
d4eb834824 Switch all tf.concat(concat_dim, value, name) calls in third_party/tensorflow to tf.concat_v2(value, axis, name).
Change: 141255675
2016-12-06 18:44:18 -08:00
A. Unique TensorFlower
0e5015bb7d Moves most metrics from contrib into core.
Change: 140914784
2016-12-02 18:07:34 -08:00