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

AttributeError: module 'tensorflow.contrib' has no attribute 'linalg' #5

Open
SeekPoint opened this issue Jul 9, 2019 · 3 comments

Comments

@SeekPoint
Copy link

ub16c9@ub16c9-gpu:/media/ub16c9/fcd84300-9270-4bbd-896a-5e04e79203b7/ub16_prj/Transformer-in-generating-dialogue/old_version$ python3.6 train.py
WARNING: Logging before flag parsing goes to stderr.
W0709 19:39:18.573528 139820381153024 init.py:308] Limited tf.compat.v2.summary API due to missing TensorBoard installation.
W0709 19:39:19.670274 139820381153024 deprecation.py:323] From /media/ub16c9/fcd84300-9270-4bbd-896a-5e04e79203b7/ub16_prj/Transformer-in-generating-dialogue/old_version/data_loader.py:102: slice_input_producer (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.from_tensor_slices(tuple(tensor_list)).shuffle(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs). If shuffle=False, omit the .shuffle(...).
W0709 19:39:19.674089 139820381153024 deprecation.py:323] From /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/input.py:374: range_input_producer (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.range(limit).shuffle(limit).repeat(num_epochs). If shuffle=False, omit the .shuffle(...).
W0709 19:39:19.681664 139820381153024 deprecation.py:323] From /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/input.py:320: input_producer (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.from_tensor_slices(input_tensor).shuffle(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs). If shuffle=False, omit the .shuffle(...).
W0709 19:39:19.682528 139820381153024 deprecation.py:323] From /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/input.py:190: limit_epochs (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.from_tensors(tensor).repeat(num_epochs).
W0709 19:39:19.683694 139820381153024 deprecation.py:323] From /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/input.py:199: QueueRunner.init (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version.
Instructions for updating:
To construct input pipelines, use the tf.data module.
W0709 19:39:19.684487 139820381153024 deprecation.py:323] From /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/input.py:199: add_queue_runner (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version.
Instructions for updating:
To construct input pipelines, use the tf.data module.
W0709 19:39:19.689042 139820381153024 deprecation.py:323] From /media/ub16c9/fcd84300-9270-4bbd-896a-5e04e79203b7/ub16_prj/Transformer-in-generating-dialogue/old_version/data_loader.py:110: shuffle_batch (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.shuffle(min_after_dequeue).batch(batch_size).
W0709 19:39:19.708497 139820381153024 deprecation_wrapper.py:119] From train.py:28: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.

W0709 19:39:19.708798 139820381153024 deprecation_wrapper.py:119] From /media/ub16c9/fcd84300-9270-4bbd-896a-5e04e79203b7/ub16_prj/Transformer-in-generating-dialogue/old_version/modules.py:110: The name tf.get_variable is deprecated. Please use tf.compat.v1.get_variable instead.

W0709 19:39:20.456506 139820381153024 lazy_loader.py:50]
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:

W0709 19:39:20.482045 139820381153024 deprecation.py:323] From train.py:47: dropout (from tensorflow.python.layers.core) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.dropout instead.
W0709 19:39:20.527111 139820381153024 deprecation.py:323] From /media/ub16c9/fcd84300-9270-4bbd-896a-5e04e79203b7/ub16_prj/Transformer-in-generating-dialogue/old_version/modules.py:159: dense (from tensorflow.python.layers.core) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.dense instead.
W0709 19:39:20.528612 139820381153024 deprecation.py:506] From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/init_ops.py:1251: calling VarianceScaling.init (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.
Instructions for updating:
Call initializer instance with the dtype argument instead of passing it to the constructor
W0709 19:39:20.767735 139820381153024 deprecation.py:323] From /media/ub16c9/fcd84300-9270-4bbd-896a-5e04e79203b7/ub16_prj/Transformer-in-generating-dialogue/old_version/modules.py:190: 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
Traceback (most recent call last):
File "train.py", line 136, in
g = Graph(True)
File "train.py", line 95, in init
scope = "self_attention")
File "/media/ub16c9/fcd84300-9270-4bbd-896a-5e04e79203b7/ub16_prj/Transformer-in-generating-dialogue/old_version/modules.py", line 200, in multihead_attention
tril = tf.contrib.linalg.LinearOperatorTriL(diag_vals).to_dense()
AttributeError: module 'tensorflow.contrib' has no attribute 'linalg'
ub16c9@ub16c9-gpu:/media/ub16c9/fcd84300-9270-4bbd-896a-5e04e79203b7/ub16_prj/Transformer-in-generating-dialogue/old_version$

@EternalFeather
Copy link
Owner

Following the official description of the tensorflow , the “linalg” package of tf1.12 version has been moved to tf.linalg.XXX

@Ailing-Zou
Copy link

If I change this row into 'tf.linalg.LinearOperatorTriL(diag_vals).to_dense()'
another error will report: module 'tensorflow._api.v1.linalg' has no attribute 'LinearOperatorTriL'
tensorflow 1.14.0

@Ailing-Zou
Copy link

After I search on google, I get the answer

  • tril = tf.contrib.linalg.LinearOperatorTriL(diag_vals).to_dense() # (T_q, T_k)
  • tril = tf.linalg.LinearOperatorLowerTriangular(diag_vals).to_dense() # (T_q, T_k)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants