<p dir="auto">Here is my code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="with tf.Session() as sess:
    # with tf.device(&quot;/cpu:0&quot;):
    x = tf.ones(shape=[3, 3])
    x_diag = tf.diag_part(x)
    x_diag_matrix = tf.matrix_diag(x_diag)
    print(sess.run(x_diag_matrix))"><pre class="notranslate"><code class="notranslate">with tf.Session() as sess:
    # with tf.device("/cpu:0"):
    x = tf.ones(shape=[3, 3])
    x_diag = tf.diag_part(x)
    x_diag_matrix = tf.matrix_diag(x_diag)
    print(sess.run(x_diag_matrix))
</code></pre></div>
<p dir="auto">It works ok on a CPU but fails in a GPU mode with the following 'CUDA_ERROR_ILLEGAL_ADDRESS' error:</p>
<blockquote>
<p dir="auto">I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library cublas64_80.dll locally<br>
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library cudnn64_5.dll locally<br>
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library cufft64_80.dll locally<br>
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library nvcuda.dll locally<br>
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library curand64_80.dll locally<br>
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:885] Found device 0 with properties:<br>
name: Tesla K40m<br>
major: 3 minor: 5 memoryClockRate (GHz) 0.745<br>
pciBusID 0000:27:00.0<br>
Total memory: 11.16GiB<br>
Free memory: 11.09GiB<br>
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:906] DMA: 0<br>
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:916] 0:   Y<br>
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -&gt; (device: 0, name: Tesla K40m, pci bus id: 0000:27:00.0)<br>
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:586] Could not identify NUMA node of /job:localhost/replica:0/task:0/gpu:0, defaulting to 0.  Your kernel may not have been built with NUMA support.<br>
E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_event.cc:49] Error polling for event status: failed to query event: CUDA_ERROR_ILLEGAL_ADDRESS<br>
F c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_event_mgr.cc:198] Unexpected Event status: 1</p>
</blockquote>
<p dir="auto">I have tried</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="x = tf.ones(shape=[3, 3])
x_diag = tf.diag_part(x)"><pre class="notranslate"><code class="notranslate">x = tf.ones(shape=[3, 3])
x_diag = tf.diag_part(x)
</code></pre></div>
<p dir="auto">and <code class="notranslate">x_diag_matrix = tf.matrix_diag([1., 1., 1.])</code> , Both work ok in a GPU mode. Maybe the tensor couldn't be input of  tf.matrix_diag() in a Windows GPU mode?</p>
<p dir="auto">Currently, sparse tensors don't support indexing, and the tf.sparse_split() operation can't split a sparse tensor according to a given proportion. If I want to select a portion of the training set (which is a sparse tensor) as the validation set, is it possible?</p>