Error in alpaca_model

i have declared base.training=False but its initial declaration was x= base_model(None,training=None)
is that a error as its giving final error as
Pls help me. if you spot some error in it.
AttributeError Traceback (most recent call last)
in
----> 1 model2 = alpaca_model(IMG_SIZE, data_augmentation)

in alpaca_model(image_shape, data_augmentation)
37 # Add the new Binary classification layers
38 # use global avg pooling to summarize the info in each channel
—> 39 x = tfl.GlobalAveragePooling2D()(x)
40 #include dropout with probability of 0.2 to avoid overfitting
41 x =tf.keras.layers.Dropout(rate = 0.2)(x)

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in call(self, *args, **kwargs)
980 with ops.name_scope_v2(name_scope):
981 if not self.built:
→ 982 self._maybe_build(inputs)
983
984 with ops.enable_auto_cast_variables(self._compute_dtype_object):

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _maybe_build(self, inputs)
2616 if not self.built:
2617 input_spec.assert_input_compatibility(
→ 2618 self.input_spec, inputs, self.name)
2619 input_list = nest.flatten(inputs)
2620 if input_list and self._dtype_policy.compute_dtype is None:

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/input_spec.py in assert_input_compatibility(input_spec, inputs, layer_name)
164 spec.min_ndim is not None or
165 spec.max_ndim is not None):
→ 166 if x.shape.ndims is None:
167 raise ValueError('Input ’ + str(input_index) + ’ of layer ’ +
168 layer_name + ’ is incompatible with the layer: ’

AttributeError: ‘function’ object has no attribute ‘shape’

The assert at line 166 in the assert stack implies that you have left some code with the “None” statement in it. You have to complete the notebook (replacing the “None” statements) before you can run the code.

Sir, they just match my code .

No, that’s incorrect.

No, that’s incorrect. You have not passed it any data to use.

1 Like

No, you are missing the 'x = ’ part of the code.

======

Why have you commented-out this line? You need the “outputs” variable in the next line of code.

1 Like

Sir i was trying to do that using Dense function

That’s fine. But you’ve only defined the layer, you haven’t passed any data to it, so you don’t get any output.
And you commented-out the line that would use the prediction layer.

And you should check the instructions and the documentation for the Dense() layer, and see if you need “relu” there.

1 Like

then should i apply ‘for’ loop to create the more training image with variation for it.

No, you don’t need any for-loops.

It would be kind of you, if you help me out, how to pass pretained data weights.

Sorry, I don’t really understand what you’re asking about.

If I understand your question:
That’s what weights = ‘imagenet’ does.

basically I want to state that x= preprocess_input is wrong then,
how can I pass the preprocess_input to it.

x = preprocess_input(x)

Thanks a lot for your support and the quick reply.
Really it helped a lot to me.