【发布时间】:2020-11-15 03:22:01
【问题描述】:
我在 TensorFlow 中设计了一个带有自定义层的神经网络。首先,我使用__call__() 定义前向传递,然后我调用了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.
但是,当我用call() 替换它时,它工作得很好。
问:我想了解幕后情况。
编辑:
我还没有创建build() 并在__init__() 中声明了所有内容
【问题讨论】:
标签: python tensorflow machine-learning deep-learning neural-network