简体   繁体   English

当我运行程序时,如何解决('module' object is not callable )的错误?

[英]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环境下写了如下代码,但是运行时遇到如下错误。

My Code:我的代码:

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

the Error is:错误是:

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.

相关问题 TypeError:“模块”对象不是可调用错误。 我该如何解决这个问题? - TypeError: 'module' object is not callable error. How do I solve this issue? 我该如何解决这个错误:当我想填充一个张量时,&#39;Tensor&#39;对象是不可调用的? - how do I solve this error:'Tensor' object is not callable when I want to fill a tensor? 我应该如何解决这个 DataFrame object is not callable 错误? - How should I solve this DataFrame object is not callable error? TypeError:&#39;NoneType&#39;对象不可调用,我该如何解决? - TypeError: 'NoneType' object is not callable , how can i solve it? 当我已经有了模块并且错误显示为:ModuleNotFoundError 时,如何运行我的程序? - How can I run my program when I already had the module and the error said: ModuleNotFoundError? 我正在尝试删除一些电子邮件,但是当我运行代码时出现以下错误: TypeError: &#39;module&#39; object is not callable (env) - I am trying to delete some emails, but when I run the code I get the following error: TypeError: 'module' object is not callable (env) 'DataFrame' object 不可调用,我该如何解决? - 'DataFrame' object is not callable, how do i solve it? 类型错误:“模块”对象不可调用。 当我运行它时它不起作用,因为第 4 行出现某种错误。我该怎么办? - TypeError: 'module' object is not callable. When I run it it does not work cuz there is some sort of error in line 4.What should I do? 如何解决Python TypeError:&#39;module&#39;对象不可调用? - How can I resolve Python TypeError: 'module' object is not callable? 类型错误:“模块”object 不可调用,我该如何解决? - TypeError: 'module' object is not callable , how can i fix it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM