i tried this code
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense
import tensorflow as tf
mnist = tf.keras.datasets.mnist
print("gud to go")
(training, newtraining)= mnist.load_data()
and this error showed
https://hastebin.com/eridajexev.sql
i have tried upgrading it and tensorflow but it shows error ,may be post how to do that ,that may work
help please?
edit:
im using version 1.9.0 of tensorflow
edit2 :
i used pip3 install --upgrade tensorflow==1.10.0 and still no and note that ,im using python3
Related
I get an error when I import the TensorFlow. I tried to reinstall it but still, I keep getting this error---> TypeError: Unable to convert function return value to a Python type! The signature was () -> handle.
import tensorflow as tf
from tensorflow.keras.layers import Add, Input, Dense, Dropout
from tensorflow.keras.layers import BatchNormalization, Embedding
from tensorflow.keras.layers import Flatten, Concatenate
from tensorflow.keras import regularizers
from keras.regularizers import l1
from keras.regularizers import l2
from tensorflow.keras import regularizers
from keras.models import Sequential
from keras.wrappers.scikit_learn import KerasClassifier
Running pip3 install numpy --upgrade solved this issue for me.
For me, the first error that came from TensorFlow is
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
which suggests a NumPy version mismatch.
Therefore, downgrading NumPy to 1.21.6 should solve the problem:
pip install numpy==1.21.6
I am trying to do several imports from the keras library. I am doing this on a Jupyter notebook using an Anaconda installed Python. I have used keras before fine, and I just checked for updates but found none. Here are the import statements.
from keras.preprocessing.text import Tokenizer
from keras.utils import to_categorical
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import SimpleRNN
from keras.layers import Embedding
I get a warning when I run this that says 'Using TensorFlow backend. Then I get a long error output that ends with 'NoneType' object has no attribute 'message_types_by_name'. Any ideas on what is wrong?
Since Tensorflow supports Keras as High level API, suggested way to import Keras libraries/modules is as below.
import tensorflow as tf
from tf.keras.preprocessing.text import Tokenizer
from tf.keras.utils import to_categorical
from tf.keras.models import Sequential
from tf.keras.layers import Dense
from tf.keras.layers import SimpleRNN
from tf.keras.layers import Embedding
Check the document from Keras here for reference.
I'm using tensorflow 1.15.0 in docker container and have issue in importing keras sub-modules.
from tensorflow import keras
import tensorflow.keras.backend as K
from tensorflow.keras.optimizers import Adam, SGD
Both backend and Adam, SGD cannot be imported.
Any solutions for this ?
I know that is too late, but I confronted the same issue and I just wanted to share the solution that worked successfully for me
try to use this instead :
import tensorflow as tf
import keras
from keras import backend as k
at least you can use Adam() like this :
tf.keras.optimizers.Adam()
the same goes for SGD() :
tf.keras.optimizers.SGD()
I just start learning tensorflow with Tutorials of Tensorflow Core.
import os
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
import tensorflow_datasets as tfds
train_data, validation_data, test_data = tfds.load(name='imdb_reviews', split=('train[:60%]', 'train[60%:]', 'test'), as_supervised=True)
then I got error like this.
error messages
Some blog says this Error can be resolved by installing tensorflow-gpu.
But in my case, that dosen't work.
How can I fix this error?
(win10, anaconda. conda ver. 4.9.2., windows terminal, anaconda prompt)
After re-installation of Anaconda and Tensorflow issue was resolved.
import os
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
import tensorflow_datasets as tfds
train_data, validation_data, test_data = tfds.load(name='imdb_reviews', split=('train[:60%]', 'train[60%:]', 'test'), as_supervised=True)
I am trying to use a pre-trained model in Tensorflow. I am using the following code:
import tensorflow as tf
from tensorflow import keras
from keras.applications import mobilenet_v2
I get the following error:
ModuleNotFoundError: No module named 'keras'
However, the following codes do work:
from tensorflow.keras.applications import mobilenet_v2
OR
from keras_applications import mobilenet_v2
The 2 methods mentioned above work but the 1st one doesn't. Why does this happen?
I've solved this problem by downgrading tensorflow to version 2.0 using this command:
pip install tensorflow==2.0
I hope it helps you.