![]() ![]() ![]() There is a very big difference between keras subclassed model and other keras models (Sequential and Functional). I'm providing input_shape for the first layer of my model, why is throwing this error? 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. ValueError: This model has not yet been built. 'ġ578 'Build the model first by calling `build()` or calling 'ġ579 '`fit()` with some data, or specify ' > 1577 raise ValueError('This model has not yet been built. usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/network.py in summary(self, line_length, positions, print_fn) ValueError Traceback (most recent call last) I'm able to compile this model without any issues > pile(optimizer=tf.(lr=lr),īut when I query the summary for this model, I see this error > model = ConvModel(nfs, input_shape=(32, 32, 3), output_shape=num_classes) (Dense(output_shape, activation='softmax'))įor layer in nvs: inputs = layer(inputs) Super(ConvModel, self)._init_(name='mlp') Return f'ConvLayer(nf=)'ĭef _init_(self, nfs, input_shape, output_shape, use_bn=False, use_dp=False): Super(ConvLayer, self).build(input_shape) # Be sure to call this at the endĭef compute_output_shape(self, input_shape): Super(ConvLayer, self)._init_(**kwargs)ĭef set_sub(self, v): = -vĭef conv_weights(self): return I've keras model defined as follow class ConvLayer(Layer) :ĭef _init_(self, nf, ks=3, s=2, **kwargs): ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |