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

The call method of DenseFeatures and SequenceFeatures use deprecated attribute _num_buckets #29881

Closed
durandg12 opened this issue Jun 17, 2019 · 9 comments
Labels
comp:keras Keras related issues stat:awaiting tensorflower Status - Awaiting response from tensorflower TF 2.0 Issues relating to TensorFlow 2.0 type:bug Bug

Comments

@durandg12
Copy link

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): no
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): macOS 10.13.6
  • TensorFlow installed from (source or binary): from pip install
  • TensorFlow version (use command below): v1.12.1-3259-gf59745a381 2.0.0-beta0
  • Python version: v3.6.7:6ec5cf24b7, Oct 20 2018, 03:02:14

Describe the current behavior

By simply calling the call method of DenseFeatures and SequenceFeatures defined with categorical_column_with_identity and sequence_categorical_column_with_identity feature columns (along with embedding_column), we get warnings that the deprecated attributes _num_buckets are used (instead of the non-deprecated num_buckets I guess).

Also note, on the code example below, that a third warning about a deprecated method, add_dispatch_support.<locals>.wrapper arises. I do not understand it but there are instructions for updating given in the warning, see the code below.

Describe the expected behavior

I think that we should not get warnings about deprecated objects when we are not calling any deprecated method, attribute, etc. I think that somewhere in the code of the call method of DenseFeatures and SequenceFeatures there is a use of _num_buckets that should be replaced by num_buckets. Following the updating instructions about the third warning may be enough to get rid of it.

Code to reproduce the issue

import numpy as np
import tensorflow as tf
from tensorflow.feature_column import categorical_column_with_identity, embedding_column, \
                                            sequence_categorical_column_with_identity
from tensorflow.keras.layers import DenseFeatures
from tensorflow.keras.experimental import SequenceFeatures

#print(tf.version.GIT_VERSION, tf.version.VERSION)

nb_features = 10
emb_dim = 3

fc = categorical_column_with_identity('feature1', nb_features)
emb_fc = embedding_column(fc, emb_dim)
layer = DenseFeatures(emb_fc)

seq_fc = sequence_categorical_column_with_identity('feature2', nb_features)
emb_seq_fc = embedding_column(seq_fc, emb_dim)
seq_layer = SequenceFeatures(emb_seq_fc)

data1 = np.array(range(nb_features))
batch_size, sequence_length = 2, 5
raw_data2 = np.array(range(nb_features))
data2 = np.reshape(raw_data2, (batch_size, sequence_length))

dict_data = {'feature1': data1, 'feature2': data2}
print(layer(dict_data))
print(seq_layer(dict_data))

produces the following three warnings:

WARNING: Logging before flag parsing goes to stderr.
W0617 19:19:42.823884 140735678825344 deprecation.py:323] From /Users/myusername/Documents/tf2beta/lib/python3.6/site-packages/tensorflow/python/feature_column/feature_column_v2.py:3040: IdentityCategoricalColumn._num_buckets (from tensorflow.python.feature_column.feature_column_v2) is deprecated and will be removed in a future version.
Instructions for updating:
The old _FeatureColumn APIs are being deprecated. Please use the new FeatureColumn APIs instead.
W0617 19:19:42.827694 140735678825344 deprecation.py:323] From /Users/myusername/Documents/tf2beta/lib/python3.6/site-packages/tensorflow/python/feature_column/feature_column_v2.py:2655: add_dispatch_support.<locals>.wrapper (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
W0617 19:19:42.833320 140735678825344 deprecation.py:323] From /Users/myusername/Documents/tf2beta/lib/python3.6/site-packages/tensorflow/python/feature_column/feature_column_v2.py:3040: SequenceCategoricalColumn._num_buckets (from tensorflow.python.feature_column.feature_column_v2) is deprecated and will be removed in a future version.
Instructions for updating:
The old _FeatureColumn APIs are being deprecated. Please use the new FeatureColumn APIs instead.
@gadagashwini-zz gadagashwini-zz self-assigned this Jun 18, 2019
@gadagashwini-zz gadagashwini-zz added 2.0.0-beta0 comp:keras Keras related issues type:support Support issues labels Jun 18, 2019
@gadagashwini-zz
Copy link
Contributor

I could see the warning message on colab with Tf 2.0.0.beta0. Thanks!

@oO0oO0oO0o0o00
Copy link

Similar problem here from beta1:

tensorflow\python\ops\math_grad.py:1250: add_dispatch_support..wrapper (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where

@mohamdev
Copy link

I've got exactly the same issue ^^ I hope someone fixes it

@ymodak ymodak added type:bug Bug and removed type:support Support issues labels Jun 21, 2019
@ymodak ymodak assigned bananabowl and unassigned bananabowl and ymodak Jun 21, 2019
@ymodak ymodak added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Jun 21, 2019
@NiksanJP
Copy link

Same here

@schroedingerskatze42
Copy link

+1 - most annoying comment ever <3

@tensorflow-bot
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@durandg12
Copy link
Author

The warnings are still here in tf2.0.0-rc0.

@durandg12
Copy link
Author

durandg12 commented Sep 25, 2019

Actually there is even one new warning when using tf2.0.0-rc0, I didn't see it the first time I tested. For the same code as above, now the output is:

WARNING: Logging before flag parsing goes to stderr.
W0925 14:12:28.993772 140735485318016 deprecation.py:323] From /path/to/python3.6/site-packages/tensorflow_core/python/feature_column/feature_column_v2.py:3089: IdentityCategoricalColumn._num_buckets (from tensorflow.python.feature_column.feature_column_v2) is deprecated and will be removed in a future version.
Instructions for updating:
The old _FeatureColumn APIs are being deprecated. Please use the new FeatureColumn APIs instead.
W0925 14:12:28.994673 140735485318016 deprecation.py:323] From /path/to/python3.6/site-packages/tensorflow_core/python/feature_column/feature_column_v2.py:353: Layer.add_variable (from tensorflow.python.keras.engine.base_layer) is deprecated and will be removed in a future version.
Instructions for updating:
Please use `layer.add_weight` method instead.
W0925 14:12:29.005573 140735485318016 deprecation.py:323] From /path/to/python3.6/site-packages/tensorflow_core/python/ops/embedding_ops.py:802: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
W0925 14:12:29.010264 140735485318016 deprecation.py:323] From /path/to/python3.6/site-packages/tensorflow_core/python/feature_column/feature_column_v2.py:3089: SequenceCategoricalColumn._num_buckets (from tensorflow.python.feature_column.feature_column_v2) is deprecated and will be removed in a future version.
Instructions for updating:
The old _FeatureColumn APIs are being deprecated. Please use the new FeatureColumn APIs instead.

See the new warning

Layer.add_variable (from tensorflow.python.keras.engine.base_layer) is deprecated and will be removed in a future version.
Instructions for updating:
Please use `layer.add_weight` method instead.

Is it possible to re-open this issue? Or should I open a new one?

Edit: it says I unassigned @bananabowl but I don't know how to do that, I just posted this new comment and then edited it.

Edit 2: mentioning @martinwicke as he is the author of the commit which caused this issue to be closed.

@durandg12
Copy link
Author

All warnings have disappeared in tf2.0.0. This one can stay closed for good.

@lvenugopalan lvenugopalan added the TF 2.0 Issues relating to TensorFlow 2.0 label Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:keras Keras related issues stat:awaiting tensorflower Status - Awaiting response from tensorflower TF 2.0 Issues relating to TensorFlow 2.0 type:bug Bug
Projects
None yet
Development

No branches or pull requests

9 participants