<blockquote>
<p dir="auto">ERROR: /home/fesun/.cache/bazel/_bazel_fesun/c44abb322eef8ca1d3dd1c34fcda8c3a/external/io_bazel_rules_closure/closure/private/defs.bzl:27:16: The <code class="notranslate">set</code> constructor for depsets is deprecated and will be removed. Please use the <code class="notranslate">depset</code> constructor instead. You can temporarily enable the deprecated <code class="notranslate">set</code> constructor by passing the flag --incompatible_disallow_set_constructor=false<br>
ERROR: error loading package '': Extension file 'closure/private/defs.bzl' has errors<br>
ERROR: error loading package '': Extension file 'closure/private/defs.bzl' has errors</p>
</blockquote>
<p dir="auto">I added the flag --incompatible_disallow_set_constructor=false for all bazel command call, then:</p>
<blockquote>
<p dir="auto">DEBUG: /home/fesun/.cache/bazel/_bazel_fesun/c44abb322eef8ca1d3dd1c34fcda8c3a/external/bazel_tools/tools/build_defs/pkg/pkg.bzl:197:9: @//tensorflow/tools/lib_package:libtensorflow_jni: you provided a non dictionary to the pkg_tar <code class="notranslate">files</code> attribute. This attribute was renamed to <code class="notranslate">srcs</code>. Consider renaming it in your BUILD file.<br>
DEBUG: /home/fesun/.cache/bazel/_bazel_fesun/c44abb322eef8ca1d3dd1c34fcda8c3a/external/bazel_tools/tools/build_defs/pkg/pkg.bzl:197:9: @//tensorflow/tools/lib_package:cheaders: you provided a non dictionary to the pkg_tar <code class="notranslate">files</code> attribute. This attribute was renamed to <code class="notranslate">srcs</code>. Consider renaming it in your BUILD file.<br>
DEBUG: /home/fesun/.cache/bazel/_bazel_fesun/c44abb322eef8ca1d3dd1c34fcda8c3a/external/bazel_tools/tools/build_defs/pkg/pkg.bzl:197:9: @//tensorflow/tools/lib_package:clib: you provided a non dictionary to the pkg_tar <code class="notranslate">files</code> attribute. This attribute was renamed to <code class="notranslate">srcs</code>. Consider renaming it in your BUILD file.<br>
DEBUG: /home/fesun/.cache/bazel/_bazel_fesun/c44abb322eef8ca1d3dd1c34fcda8c3a/external/bazel_tools/tools/build_defs/pkg/pkg.bzl:197:9: @//tensorflow/tools/lib_package:clicenses: you provided a non dictionary to the pkg_tar <code class="notranslate">files</code> attribute. This attribute was renamed to <code class="notranslate">srcs</code>. Consider renaming it in your BUILD file.<br>
ERROR: /home/fesun/tensorflow/tensorflow/core/kernels/BUILD:59:14: Traceback (most recent call last):<br>
File "/home/fesun/tensorflow/tensorflow/core/kernels/BUILD", line 54<br>
config_setting(name = "xsmm_backward", values = {..."})<br>
File "/home/fesun/tensorflow/tensorflow/core/kernels/BUILD", line 59, in config_setting<br>
{"define": "tensorflow_xsmm=1", "define": "tensorflow_xsmm_backward=1"}<br>
Duplicated key "define" when creating dictionary<br>
ERROR: package contains errors: tensorflow/core/kernels<br>
ERROR: error loading package 'tensorflow/core/kernels': Package 'tensorflow/core/kernels' contains errors</p>
</blockquote>
<p dir="auto">Any solution for this?</p>
<p dir="auto">This is a possible duplicate of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="144958009" data-permission-text="Title is private" data-url="https://github.com/tensorflow/tensorflow/issues/1727" data-hovercard-type="issue" data-hovercard-url="/tensorflow/tensorflow/issues/1727/hovercard" href="https://github.com/tensorflow/tensorflow/issues/1727">#1727</a>. Posting here as there is no way to re-open or comment on the previous bug.<br>
The comments suggests that the updating the driver would most probably fix the issue but its not the case.</p>
<p dir="auto"><strong>Environment info</strong><br>
Distributor ID:	Ubuntu<br>
Description:	Ubuntu 16.04.2 LTS<br>
Release:	16.04<br>
Codename:	xenial</p>
<blockquote>
<p dir="auto"><code class="notranslate">python3 -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"</code><br>
<code class="notranslate">v1.1.0-rc0-61-g1ec6ed5 1.1.0</code></p>
</blockquote>
<blockquote>
<p dir="auto"><code class="notranslate">nvidia-smi</code><br>
<code class="notranslate">NVIDIA-SMI 375.51                 Driver Version: 375.51</code></p>
</blockquote>
<p dir="auto"><strong>Before starting the service</strong><br>
0     27825    C   /usr/bin/python3                                35MiB</p>
<p dir="auto"><strong>After deleting the session</strong><br>
Note that I am creating the session and loading a checkpoint, running the session and then closing it explicitly with <code class="notranslate">session.close()</code>. I am also resetting the graph by calling <code class="notranslate">tf.reset_default_graph()</code> after closing the session.<br>
0     27825    C   /usr/bin/python3                              1435MiB</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="device_t='/gpu:0'
graph = tf.Graph()
soft_config = tf.ConfigProto(allow_soft_placement=True)
soft_config.gpu_options.allow_growth = True . #tried both True and False and doesn't seem to help
with graph.as_default(), graph.device(device_t), tf.Session(config=soft_config) as sess:
    batch_shape = (batch_size,) + img.shape
    img_placeholder = tf.placeholder(tf.float32, shape=batch_shape,
                                     name=&quot;img_placeholder&quot;)
    preds = transform.net(img_placeholder)
    saver = tf.train.Saver()
    saver.restore(sess, checkpoint_dir)

    content = np.zeros(batch_shape, dtype=np.float32)
    content[0] = img

    _preds = sess.run(preds, feed_dict={img_placeholder: content})
    result = crop_img(_preds[0].astype(data_in.dtype))
    sess.close()   #Explicitly closing the session and deleting does not help as well. 
    del sess
tf.reset_default_graph()
return result"><pre class="notranslate"><code class="notranslate">device_t='/gpu:0'
graph = tf.Graph()
soft_config = tf.ConfigProto(allow_soft_placement=True)
soft_config.gpu_options.allow_growth = True . #tried both True and False and doesn't seem to help
with graph.as_default(), graph.device(device_t), tf.Session(config=soft_config) as sess:
    batch_shape = (batch_size,) + img.shape
    img_placeholder = tf.placeholder(tf.float32, shape=batch_shape,
                                     name="img_placeholder")
    preds = transform.net(img_placeholder)
    saver = tf.train.Saver()
    saver.restore(sess, checkpoint_dir)

    content = np.zeros(batch_shape, dtype=np.float32)
    content[0] = img

    _preds = sess.run(preds, feed_dict={img_placeholder: content})
    result = crop_img(_preds[0].astype(data_in.dtype))
    sess.close()   #Explicitly closing the session and deleting does not help as well. 
    del sess
tf.reset_default_graph()
return result
</code></pre></div>
<p dir="auto">Here are some of the relevant logs.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="2017-05-18 18:49:16.556719: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-18 18:49:16.556757: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-18 18:49:16.556775: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-05-18 18:49:16.584028: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:901] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2017-05-18 18:49:16.584295: I tensorflow/core/common_runtime/gpu/gpu_device.cc:887] Found device 0 with properties: 
name: GRID K520
major: 3 minor: 0 memoryClockRate (GHz) 0.797
pciBusID 0000:00:03.0
Total memory: 3.94GiB
Free memory: 3.87GiB
2017-05-18 18:49:16.584326: I tensorflow/core/common_runtime/gpu/gpu_device.cc:908] DMA: 0 
2017-05-18 18:49:16.584344: I tensorflow/core/common_runtime/gpu/gpu_device.cc:918] 0:   Y 
2017-05-18 18:49:16.584368: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] Creating TensorFlow device (/gpu:0) -&gt; (device: 0, name: GRID K520, pci bus id: 0000:00:03.0)
2017-05-18 18:49:16.585190: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] Creating TensorFlow device (/gpu:0) -&gt; (device: 0, name: GRID K520, pci bus id: 0000:00:03.0)

"><pre class="notranslate"><code class="notranslate">2017-05-18 18:49:16.556719: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-18 18:49:16.556757: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-05-18 18:49:16.556775: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-05-18 18:49:16.584028: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:901] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2017-05-18 18:49:16.584295: I tensorflow/core/common_runtime/gpu/gpu_device.cc:887] Found device 0 with properties: 
name: GRID K520
major: 3 minor: 0 memoryClockRate (GHz) 0.797
pciBusID 0000:00:03.0
Total memory: 3.94GiB
Free memory: 3.87GiB
2017-05-18 18:49:16.584326: I tensorflow/core/common_runtime/gpu/gpu_device.cc:908] DMA: 0 
2017-05-18 18:49:16.584344: I tensorflow/core/common_runtime/gpu/gpu_device.cc:918] 0:   Y 
2017-05-18 18:49:16.584368: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] Creating TensorFlow device (/gpu:0) -&gt; (device: 0, name: GRID K520, pci bus id: 0000:00:03.0)
2017-05-18 18:49:16.585190: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] Creating TensorFlow device (/gpu:0) -&gt; (device: 0, name: GRID K520, pci bus id: 0000:00:03.0)


</code></pre></div>