Issue 1:
I just reinstalled Tensorflow on my laptop this morning and got this problem.

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

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

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

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

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

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

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

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

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

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

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

b'what the hell?'

Issue 2:
System information

See the custom complete snippet below

Linux Ubuntu 16.04

TensorFlow installed via pip gpu version

TensorFlow version v1.12.0-0-ga6d8ffae09 1.12.0

Python version: 3.5.2

CUDA/cuDNN version: 9.0.176 / 7.4.1

GPU model and memory: GeForce GTX 1080 with 11178MiB

Describe the current behavior

If using tf.enable_eager_execution() the code expects non Keras optimizer,

if using "standard" behavior (compiled graph) the code runs fine.

See the code and logs below.

Describe the expected behavior

tf.enable_eager_execution() should not affect the behavior and the code should run in both cases.

Code to reproduce the issue

Copied from my repository https://github.com/oplatek/tf-eager-playground/blob/master/eagerplayer/test_train.py

#!/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) > 1 and sys.argv[1] == 'eager':
tf.enable_eager_execution() # fails with eager execution enabled
fit_keras_model()
print('success')

Other info / logs

The logs are copied also from my repository https://github.com/oplatek/tf-eager-playground/blob/master/eagerplayer/test_train.md

Without eager execution the code works fine

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) -> 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

With eager execution non Keras optimizer is expected

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) -> 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 <module>
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 <class 'str'>