reinforcement-learning-kr-v2
reinforcement-learning-kr-v2 copied to clipboard
model summary 는 어떻게 봐야하나요?
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.
이런 에러가 나오면서 모델 요약을 안보여주는데 어느 부분에서 봐야하나요?
자답합니다. 여러군데 검색한 결과
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()은 현 상태에서는 오직 요약을 보는 용도이고 따로 쓸데는 없군요. ㅠㅠ