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

model summary 는 어떻게 봐야하나요? #18

Open
rubyjohn opened this issue Dec 24, 2020 · 1 comment
Open

model summary 는 어떻게 봐야하나요? #18

rubyjohn opened this issue Dec 24, 2020 · 1 comment

Comments

@rubyjohn
Copy link

2-breakout-a3c 에서 train.py 를 해보는 중인데,

self.global_model.summary()
해봤더니 모델 요약 조금 나오다
ValueError: You tried to call count_params on conv2d_2, but the layer isn't built. You can build it manually via: conv2d_2.build(batch_input_shape).

self.local_model.summary()
해봤더니
ValueError: This model has not yet been built. Build the model first by calling build() or calling fit() with some data, or specify an input_shape argument in the first layer(s) for automatic build.

이런 에러가 나오면서 모델 요약을 안보여주는데
어느 부분에서 봐야하나요?

@rubyjohn
Copy link
Author

rubyjohn commented Dec 30, 2020

자답합니다.
여러군데 검색한 결과

from tensorflow.keras.layers import Input
from tensorflow.keras.models import Model

class ActorCritic(tf.keras.Model):
    ...
    def model(self):
        x = Input(shape=self.state_size)
        return Model(inputs=[x], outputs=self.call(x))

이렇게 선언한뒤
요약을 봐야하는 곳에서

self.global_model.model().summary()

이런식으로 하면 볼 수 있군요.
다만 저 def model()은 현 상태에서는
오직 요약을 보는 용도이고 따로 쓸데는 없군요. ㅠㅠ

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

1 participant