gpt4 book ai didi

python-3.x - 类型错误 : compile() missing 1 required positional argument: 'self'

转载 作者:行者123 更新时间:2023-12-02 15:12:14 24 4
gpt4 key购买 nike

model.compile 中的“self”是什么?我尝试在 keras 模型中使用 python 运行代码我收到此错误:

model.compile(loss="binary_crossentropy", optimizer='adam', metrics=['accuracy'])
TypeError: compile() missing 1 required positional argument: 'self'

最佳答案

实例化类然后使用方法...应该是这样的

model().compile()

or
m = model()
m.compile()

关于python-3.x - 类型错误 : compile() missing 1 required positional argument: 'self' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43071310/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com