[英]How can I solve the error of ( 'module' object is not callable ) when i run the program?
I have written the following code in the spider environment, but I am facing the following error when running.我在spider环境下写了如下代码,但是运行时遇到如下错误。
import numpy as np
import keras
from keras import models
### Generate random training an testing sets
x_train = np.random.random((1000,20))
y_train = np.random.randint(low = 2 , size = (x_train.shape[0] , 1))
x_test = np.random.random((100,20))
y_test = np.random.randint(low = 2 , size = (100 , 1))
### Defining layers of the MLP model
m = keras.models.sequential()
m = keras.models.sequential()
Traceback (most recent call last):
File "C:\Users\hossein\AppData\Local\Temp\ipykernel_464\416401841.py", line 1, in <module>
m = keras.models.sequential()
TypeError: 'module' object is not callable
"module object is not callable. Python is telling that code trying to call something that cannot be called. What is my code trying to call?" “模块 object 不可调用。Python 告诉代码试图调用无法调用的东西。我的代码试图调用什么?”
try尝试
from tensorflow import keras
from keras.models import load_model
from keras.models import sequential
for reference TypeError: 'module' object is not callable供参考TypeError: 'module' object is not callable
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.