Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extraneous depecation message caused by setdiff1d #42935

Merged

Conversation

yongtang
Copy link
Member

@yongtang yongtang commented Sep 3, 2020

This PR tries to address the issue raised in #42909 where extraneous
deprecation messages showed up when with the following:

import tensorflow as tf

x = tf.ones(5)
with tf.GradientTape() as g:
    g.watch(x)
    y = tf.math.reduce_prod(x)

grad = g.gradient(y, x)
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_grad.py:300: setdiff1d (from tensorflow.python.ops.array_ops) is deprecated and will be removed after 2018-11-30.
Instructions for updating:
This op will be removed after the deprecation date. Please switch to tf.sets.difference().

The deprecation is misleading to users.

This PR switch to use internal gen_array_ops.list_diff so that
deprecation messages will not be triggered.

Several other places using setdiff1d have also been fixed.

This PR fixes #42909.

Signed-off-by: Yong Tang yong.tang.github@outlook.com

This PR tries to address the issue raised in 42909 where extraneous
deprecation messages showed up when with the following:
```
import tensorflow as tf

x = tf.ones(5)
with tf.GradientTape() as g:
    g.watch(x)
    y = tf.math.reduce_prod(x)

grad = g.gradient(y, x)
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_grad.py:300: setdiff1d (from tensorflow.python.ops.array_ops) is deprecated and will be removed after 2018-11-30.
Instructions for updating:
This op will be removed after the deprecation date. Please switch to tf.sets.difference().
```

The deprecation is misleading to users.

This PR switch to use internal `gen_array_ops.list_diff` so that
deprecation messages will not be triggered.

Several other places using setdiff1d have also been fixed.

This PR fixes 42909.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
@gbaned gbaned self-assigned this Sep 4, 2020
@gbaned gbaned added comp:ops OPs related issues prtype:bugfix PR to fix a bug labels Sep 4, 2020
@gbaned gbaned added this to Assigned Reviewer in PR Queue via automation Sep 4, 2020
@gbaned gbaned requested a review from mdanatg September 4, 2020 02:37
PR Queue automation moved this from Assigned Reviewer to Approved by Reviewer Sep 4, 2020
@google-ml-butler google-ml-butler bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Sep 4, 2020
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Sep 4, 2020
@tensorflow-copybara tensorflow-copybara merged commit 5f1f7e5 into tensorflow:master Sep 4, 2020
PR Queue automation moved this from Approved by Reviewer to Merged Sep 4, 2020
@yongtang yongtang deleted the 42909-setdiff1d-deprecation branch September 4, 2020 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes comp:ops OPs related issues prtype:bugfix PR to fix a bug ready to pull PR ready for merge process size:S CL Change Size: Small
Projects
PR Queue
  
Merged
Development

Successfully merging this pull request may close these issues.

Deprecated function setdiff1d still used in the tf source code
6 participants