Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ex4_2_cnn_cifar10_cl 실행하니 you forgot to call super(YourClass, self).__init__() 에러가 납니다. #3

Open
softgearko opened this issue Jul 31, 2018 · 3 comments

Comments

@softgearko
Copy link

ex4_2_cnn_cifar10_cl 실행하니 아래와 같은 에러가 납니다.
도와주세요.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/softg/PycharmProjects/test/keraspp/ex4_2_cnn_cifar10_cl.py", line 22, in <module>
    main()
  File "C:/Users/softg/PycharmProjects/test/keraspp/ex4_2_cnn_cifar10_cl.py", line 18, in main
    m = Machine()
  File "C:/Users/softg/PycharmProjects/test/keraspp/ex4_2_cnn_cifar10_cl.py", line 14, in __init__
    super().__init__(X, y, nb_classes=10)
  File "C:\Users\softg\PycharmProjects\test\keraspp\keraspp\aicnn.py", line 125, in __init__
    self.set_model()
  File "C:\Users\softg\PycharmProjects\test\keraspp\keraspp\aicnn.py", line 136, in set_model
    self.model = CNN(nb_classes=nb_classes, in_shape=data.input_shape)
  File "C:\Users\softg\PycharmProjects\test\keraspp\keraspp\aicnn.py", line 25, in __init__
    model.build_model()
  File "C:\Users\softg\PycharmProjects\test\keraspp\keraspp\aicnn.py", line 49, in build_model
    model.cl_part = Model(x, z_cl)
  File "C:\Users\softg\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\network.py", line 316, in __setattr__
    'It looks like you are subclassing `Model` and you '
RuntimeError: It looks like you are subclassing `Model` and you forgot to call `super(YourClass, self).__init__()`. Always start with this line.

Process finished with exit code 1
@kim-taehee
Copy link

같은 에러가 발생합니다

@dnr3663
Copy link

dnr3663 commented Jan 9, 2019

class CNN(Model):
def init(model, nb_classes, in_shape=None):
super().init() <<-- 추가하여 해결하였습니다.
model.nb_classes = nb_classes
model.in_shape = in_shape
model.build_model()
super().init(model.x, model.y)
model.compile()

@yong6600
Copy link

keras version 을 2.2.2에서 2.1.3으로 다운그레이딩 하여 해결 하였습니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants