-
Notifications
You must be signed in to change notification settings - Fork 74.9k
Closed
Description
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
yes - OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
Linux Ubuntu 16.04 - Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
- TensorFlow installed from (source or binary):
source - TensorFlow version (use command below):
== cat /etc/issue ===============================================
Linux 3bed2f328777 4.13.0-38-generic #43~16.04.1-Ubuntu SMP Wed Mar 14 17:48:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
VERSION="16.04.5 LTS (Xenial Xerus)"
VERSION_ID="16.04"
VERSION_CODENAME=xenial
== are we in docker =============================================
Yes
== compiler =====================================================
c++ (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
== uname -a =====================================================
Linux 3bed2f328777 4.13.0-38-generic #43~16.04.1-Ubuntu SMP Wed Mar 14 17:48:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
== check pips ===================================================
numpy (1.14.5)
protobuf (3.6.1)
tensorflow (1.10.0)
== check for virtualenv =========================================
False
== tensorflow import ============================================
tf.VERSION = 1.10.0
tf.GIT_VERSION = b'unknown'
tf.COMPILER_VERSION = b'unknown'
Sanity check: array([1], dtype=int32)
== env ==========================================================
LD_LIBRARY_PATH /usr/local/cuda/lib64/stubs:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64/stubs:/usr/local/cuda/lib64/stubs:/usr/local/cuda/extras/CUPTI/lib64:/lib/amd64/server/:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server:/opt/boost/lib:/opt/conda/lib/:/usr/local/cuda/lib64/:/opt/conda/lib/R/lib/:/usr/local/nvidia/lib64/:/usr/local/nvidia/lib:/lib/x86_64-linux-gnu:/usr/local/cuda/extras/CUPTI/lib64:/usr/lib/x86_64-linux-gnu:/opt/opencv/lib
DYLD_LIBRARY_PATH is unset
== nvidia-smi ===================================================
Wed Aug 29 19:57:14 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 396.26 Driver Version: 396.26 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 108... Off | 00000000:01:00.0 On | N/A |
| 0% 41C P0 76W / 250W | 708MiB / 11177MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
+-----------------------------------------------------------------------------+
== cuda libs ===================================================
/usr/local/cuda-9.2/targets/x86_64-linux/lib/libcudart.so.9.2.148
/usr/local/cuda-9.2/targets/x86_64-linux/lib/libcudart_static.a
1080Ti
- Exact command to reproduce:
import tensorflow as tf
a = tf.random_uniform(minval=0, maxval=9, shape=[], dtype=tf.int32)
img = tf.zeros([10], dtype=tf.int32)
img_z = tf.scatter_nd_update(img, a, tf.zeros_like(a))
You can collect some of this information using our environment capture script:
https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh
You can obtain the TensorFlow version with
python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"
Describe the problem
I am not able to update a variable using tf.scatter_nd_update with indices/updates coming from Tensors tf.random_uniform. In another part of my code I use indices and updates coming from tf.nn.top_k and that works fine.
Source code / logs
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-9-ed4c565a2efd> in <module>()
3 a = tf.random_uniform(minval=0, maxval=10, shape=[], dtype=tf.int32)
4 img = tf.zeros([9], dtype=tf.int32)
----> 5 img_z = tf.scatter_nd_update(img, a, tf.zeros_like(a))
6
7 with tf.Session() as sess:
/opt/conda/lib/python3.6/site-packages/tensorflow/python/ops/state_ops.py in scatter_nd_update(ref, indices, updates, use_locking, name)
357 return gen_state_ops.scatter_nd_update(
358 ref, indices, updates, use_locking, name)
--> 359 return ref._lazy_read(gen_state_ops.resource_scatter_nd_update( # pylint: disable=protected-access
360 ref.handle, indices, ops.convert_to_tensor(updates, ref.dtype),
361 name=name))
AttributeError: 'Tensor' object has no attribute '_lazy_read'
Metadata
Metadata
Assignees
Labels
No labels