<p dir="auto">I just reinstalled Tensorflow on my laptop this morning and got this problem.<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "BestSplits" device_type: "CPU"') for unknown op: BestSplits<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "CountExtremelyRandomStats" device_type: "CPU"') for unknown op: CountExtremelyRandomStats<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "FinishedNodes" device_type: "CPU"') for unknown op: FinishedNodes<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "GrowTree" device_type: "CPU"') for unknown op: GrowTree<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "ReinterpretStringToFloat" device_type: "CPU"') for unknown op: ReinterpretStringToFloat<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "SampleInputs" device_type: "CPU"') for unknown op: SampleInputs<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "ScatterAddNdim" device_type: "CPU"') for unknown op: ScatterAddNdim<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TopNInsert" device_type: "CPU"') for unknown op: TopNInsert<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TopNRemove" device_type: "CPU"') for unknown op: TopNRemove<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "TreePredictions" device_type: "CPU"') for unknown op: TreePredictions<br>
E c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\framework\op_kernel.cc:943] OpKernel ('op: "UpdateFertileSlots" device_type: "CPU"') for unknown op: UpdateFertileSlots<br>
b'what the hell?'</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/10723417/24329241/5ffd36fe-123b-11e7-8298-c957a13b3141.PNG"><img src="https://cloud.githubusercontent.com/assets/10723417/24329241/5ffd36fe-123b-11e7-8298-c957a13b3141.PNG" alt="tensorflow" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>System information</strong></p>
<ul dir="auto">
<li>See the custom complete snippet below</li>
<li>Linux Ubuntu 16.04</li>
<li>TensorFlow installed via pip gpu version</li>
<li>TensorFlow version v1.12.0-0-ga6d8ffae09 1.12.0</li>
<li>Python version: 3.5.2</li>
<li>CUDA/cuDNN version: 9.0.176 / 7.4.1</li>
<li>GPU model and memory: GeForce GTX 1080  with 11178MiB</li>
</ul>
<p dir="auto"><strong>Describe the current behavior</strong><br>
If using <code class="notranslate">tf.enable_eager_execution()</code> the code expects non Keras optimizer,<br>
if using "standard" behavior (compiled graph) the code runs fine.<br>
See the code and logs below.</p>
<p dir="auto"><strong>Describe the expected behavior</strong><br>
<code class="notranslate">tf.enable_eager_execution()</code> should not affect the behavior and the code should run in both cases.</p>
<p dir="auto"><strong>Code to reproduce the issue</strong><br>
Copied from my repository <a href="https://github.com/oplatek/tf-eager-playground/blob/master/eagerplayer/test_train.py">https://github.com/oplatek/tf-eager-playground/blob/master/eagerplayer/test_train.py</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#!/usr/bin/env python3
import tensorflow as tf
import numpy as np
import sys

from tensorflow.keras.layers import Input, Dense
from tensorflow.keras.models import Model


def fit_keras_model():
    data = np.random.random((1000, 32))
    labels = np.random.random((1000, 10))
    # source https://keras.io/getting-started/functional-api-guide/
    # This returns a tensor
    inputs = Input(shape=(32,))

    # a layer instance is callable on a tensor, and returns a tensor
    x = Dense(64, activation='relu')(inputs)
    x = Dense(64, activation='relu')(x)
    predictions = Dense(10, activation='softmax')(x)

    # This creates a model that includes
    # the Input layer and three Dense layers
    model = Model(inputs=inputs, outputs=predictions)
    model.compile(optimizer='adam',
                  loss='categorical_crossentropy',
                  metrics=['accuracy'])
    model.fit(data, labels)  # starts training
    return model


if __name__ == '__main__':
    if len(sys.argv) &gt; 1 and sys.argv[1] == 'eager':
        tf.enable_eager_execution()  # fails with eager execution enabled
    fit_keras_model()
    print('success')"><pre class="notranslate"><code class="notranslate">#!/usr/bin/env python3
import tensorflow as tf
import numpy as np
import sys

from tensorflow.keras.layers import Input, Dense
from tensorflow.keras.models import Model


def fit_keras_model():
    data = np.random.random((1000, 32))
    labels = np.random.random((1000, 10))
    # source https://keras.io/getting-started/functional-api-guide/
    # This returns a tensor
    inputs = Input(shape=(32,))

    # a layer instance is callable on a tensor, and returns a tensor
    x = Dense(64, activation='relu')(inputs)
    x = Dense(64, activation='relu')(x)
    predictions = Dense(10, activation='softmax')(x)

    # This creates a model that includes
    # the Input layer and three Dense layers
    model = Model(inputs=inputs, outputs=predictions)
    model.compile(optimizer='adam',
                  loss='categorical_crossentropy',
                  metrics=['accuracy'])
    model.fit(data, labels)  # starts training
    return model


if __name__ == '__main__':
    if len(sys.argv) &gt; 1 and sys.argv[1] == 'eager':
        tf.enable_eager_execution()  # fails with eager execution enabled
    fit_keras_model()
    print('success')
</code></pre></div>
<p dir="auto"><strong>Other info / logs</strong><br>
The logs are copied also from my repository <a href="https://github.com/oplatek/tf-eager-playground/blob/master/eagerplayer/test_train.md">https://github.com/oplatek/tf-eager-playground/blob/master/eagerplayer/test_train.md</a></p>
<h2 dir="auto">Without eager execution the code works fine</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="oplatek@gpu:master:tf-eager-playground$ ./eagerplayer/test_train.py
Epoch 1/1
2019-01-30 16:49:23.921582: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-01-30 16:49:24.032120: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:964] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-01-30 16:49:24.032526: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.6575
pciBusID: 0000:01:00.0
totalMemory: 10.92GiB freeMemory: 10.76GiB
2019-01-30 16:49:24.032540: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2019-01-30 16:49:24.230759: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-01-30 16:49:24.230787: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988]      0
2019-01-30 16:49:24.230792: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0:   N
2019-01-30 16:49:24.230947: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10407 MB memory) -&gt; physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
1000/1000 [==============================] - 1s 745us/step - loss: 11.4860 - acc: 0.0810
success"><pre class="notranslate"><code class="notranslate">oplatek@gpu:master:tf-eager-playground$ ./eagerplayer/test_train.py
Epoch 1/1
2019-01-30 16:49:23.921582: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-01-30 16:49:24.032120: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:964] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-01-30 16:49:24.032526: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.6575
pciBusID: 0000:01:00.0
totalMemory: 10.92GiB freeMemory: 10.76GiB
2019-01-30 16:49:24.032540: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2019-01-30 16:49:24.230759: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-01-30 16:49:24.230787: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988]      0
2019-01-30 16:49:24.230792: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0:   N
2019-01-30 16:49:24.230947: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10407 MB memory) -&gt; physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
1000/1000 [==============================] - 1s 745us/step - loss: 11.4860 - acc: 0.0810
success
</code></pre></div>
<h2 dir="auto">With eager execution non Keras optimizer is expected</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="oplatek@gpu:master:tf-eager-playground$ ./eagerplayer/test_train.py eager
2019-01-30 16:49:33.983911: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-01-30 16:49:34.069258: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:964] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-01-30 16:49:34.069657: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.6575
pciBusID: 0000:01:00.0
totalMemory: 10.92GiB freeMemory: 10.76GiB
2019-01-30 16:49:34.069671: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2019-01-30 16:49:34.266286: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-01-30 16:49:34.266311: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988]      0
2019-01-30 16:49:34.266316: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0:   N
2019-01-30 16:49:34.266465: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10407 MB memory) -&gt; physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
Traceback (most recent call last):
  File &quot;./eagerplayer/test_train.py&quot;, line 35, in &lt;module&gt;
	fit_keras_model()
  File &quot;./eagerplayer/test_train.py&quot;, line 27, in fit_keras_model
	metrics=['accuracy'])
  File &quot;/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/checkpointable/base.py&quot;, line 474, in _method_wrapper
	method(self, *args, **kwargs)
  File &quot;/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/engine/training.py&quot;, line 410, in compile
	'a %s' % type(optimizer))
ValueError: optimizer must be an instance of tf.train.Optimizer, not a &lt;class 'str'&gt;"><pre class="notranslate"><code class="notranslate">oplatek@gpu:master:tf-eager-playground$ ./eagerplayer/test_train.py eager
2019-01-30 16:49:33.983911: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-01-30 16:49:34.069258: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:964] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-01-30 16:49:34.069657: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.6575
pciBusID: 0000:01:00.0
totalMemory: 10.92GiB freeMemory: 10.76GiB
2019-01-30 16:49:34.069671: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2019-01-30 16:49:34.266286: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-01-30 16:49:34.266311: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988]      0
2019-01-30 16:49:34.266316: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0:   N
2019-01-30 16:49:34.266465: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10407 MB memory) -&gt; physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
Traceback (most recent call last):
  File "./eagerplayer/test_train.py", line 35, in &lt;module&gt;
	fit_keras_model()
  File "./eagerplayer/test_train.py", line 27, in fit_keras_model
	metrics=['accuracy'])
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/checkpointable/base.py", line 474, in _method_wrapper
	method(self, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/engine/training.py", line 410, in compile
	'a %s' % type(optimizer))
ValueError: optimizer must be an instance of tf.train.Optimizer, not a &lt;class 'str'&gt;
</code></pre></div>