purpose
The combination of Keras and Tensorflow is very convenient. However, there are a lot of pits.
* the question is:
AttributeError: module ‘tensorflow. Python. The framework. The ops’ has no attribute’ _TensorLike
because keras import and tensorflow keras import of primary and secondary, there are differences in structure;
Modify the
Br> from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from keras. optimzimport RMSprop
Modified
the from tensorflow. Keras. Models import Sequential
the from tensorflow. Keras. The layers import Dense, Dropout, Activation
the from tensorflow. Keras. Optimizers import RMSprop
There are twists and turns in between
The previous python3.6 + keras that were initially searched were as :
tensorflow_backend.py line703
def is_tensor(x):
return isinstance(x, tf_ops._TensorLike) or tf_ops. Is_dense_tensor_like (x)
return type modified as:
return isinstance(x, core_tf_types.or tf_ops. Is_dense_tensor_like (x)
* the result changes one bug and introduces another:
* ValueError: updates
argument is not supported during eager execution. And this bug is only an updated version, but mine is the latest version; Tangled for a long time, a face covered in circles.
* finally restore the modification, return to search the original wrong solution. Find the one above.
conclusion
Try more than one problem modification. If one problem modification introduces another, then either follow the problem modification. Or go back to the origin and find the answer again. That is, if you change one problem and introduce another, then maybe you started with the wrong solution.
Read More:
- Keras saves save() and save in the model_ weights()
- The function of flatten layer in deep learning
- Solve the problem of using in tensoft 2. X tf.contrib.slim No module named appears in the package: tensorflow.contrib problem
- Attributeerror: module tensorflow no attribute app solution
- tf.contrib.layers .xavier_ Initializer function usage
- Problem solving module ‘ tensorflow.compat . V2 ‘has no attribute’ contrib ‘and importerror cannot import name’ auto ‘
- Usage of Python dropout
- Resolve importerror: cannot import name ‘TF_ utils’
- InternalError: Failed to create session. Error and solution
- After the model is instantiated by keras, the result returns nonetype
- Tensorflow error: module ‘tensorflow’ has no attribute ‘xxx’
- tf.gradients is not supported when eager execution is enabled. Use tf.GradientTape instead.
- Tensorflow 2.1.0 error resolution: failed call to cuinit: CUDA_ ERROR_ NO_ DEVICE: no CUDA-capable device is detected
- tensorflow2.1 Error:Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR
- ImportError: DLL load failed: The specified module could not be found
- Exception ignored in: bound method basesession__ del__ Of
- Tensorflow in function tf.Print Method of outputting intermediate value
- numpy.core.umath How to solve the problem of failed to import
- Tensorflow with tf.Session The usage of () as sess
- Windows10解决ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed