here is the error i am getting
---------------------------------------------------------------------------
InvalidArgumentError Traceback (most recent call last)
<ipython-input-90-11ffc7a7acb3> in <module>
----> 1 model2 = alpaca_model(IMG_SIZE, data_augmentation)
<ipython-input-89-d64e5a7facd7> in alpaca_model(image_shape, data_augmentation)
32 x = preprocess_input(x)
33 # set training to False to avoid keeping track of statistics in the batch norm layer
---> 34 x = base_model(input_shape,training=False)(x)
35
36 # Add the new Binary classification layers
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in __call__(self, *args, **kwargs)
983
984 with ops.enable_auto_cast_variables(self._compute_dtype_object):
--> 985 outputs = call_fn(inputs, *args, **kwargs)
986
987 if self._activity_regularizer:
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/functional.py in call(self, inputs, training, mask)
384 """
385 return self._run_internal_graph(
--> 386 inputs, training=training, mask=mask)
387
388 def compute_output_shape(self, input_shape):
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/functional.py in _run_internal_graph(self, inputs, training, mask)
506
507 args, kwargs = node.map_arguments(tensor_dict)
--> 508 outputs = node.layer(*args, **kwargs)
509
510 # Update tensor_dict.
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in __call__(self, *args, **kwargs)
983
984 with ops.enable_auto_cast_variables(self._compute_dtype_object):
--> 985 outputs = call_fn(inputs, *args, **kwargs)
986
987 if self._activity_regularizer:
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/layers/convolutional.py in call(self, inputs)
2848 def call(self, inputs):
2849 return backend.spatial_2d_padding(
-> 2850 inputs, padding=self.padding, data_format=self.data_format)
2851
2852 def get_config(self):
/opt/conda/lib/python3.7/site-packages/tensorflow/python/util/dispatch.py in wrapper(*args, **kwargs)
199 """Call target, and fall back on dispatchers if there is a TypeError."""
200 try:
--> 201 return target(*args, **kwargs)
202 except (TypeError, ValueError):
203 # Note: convert_to_eager_tensor currently raises a ValueError, not a
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/backend.py in spatial_2d_padding(x, padding, data_format)
3325 else:
3326 pattern = [[0, 0], list(padding[0]), list(padding[1]), [0, 0]]
-> 3327 return array_ops.pad(x, pattern)
3328
3329
/opt/conda/lib/python3.7/site-packages/tensorflow/python/util/dispatch.py in wrapper(*args, **kwargs)
199 """Call target, and fall back on dispatchers if there is a TypeError."""
200 try:
--> 201 return target(*args, **kwargs)
202 except (TypeError, ValueError):
203 # Note: convert_to_eager_tensor currently raises a ValueError, not a
/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py in pad(tensor, paddings, mode, name, constant_values)
3341 # remove the "Pad" fallback here.
3342 if not tensor_util.is_tensor(constant_values) and constant_values == 0:
-> 3343 result = gen_array_ops.pad(tensor, paddings, name=name)
3344 else:
3345 result = gen_array_ops.pad_v2(
/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/gen_array_ops.py in pad(input, paddings, name)
6558 try:
6559 return pad_eager_fallback(
-> 6560 input, paddings, name=name, ctx=_ctx)
6561 except _core._SymbolicException:
6562 pass # Add nodes to the TensorFlow graph.
/opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/gen_array_ops.py in pad_eager_fallback(input, paddings, name, ctx)
6583 _attrs = ("T", _attr_T, "Tpaddings", _attr_Tpaddings)
6584 _result = _execute.execute(b"Pad", 1, inputs=_inputs_flat, attrs=_attrs,
-> 6585 ctx=ctx, name=name)
6586 if _execute.must_record_gradient():
6587 _execute.record_gradient(
/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
58 ctx.ensure_initialized()
59 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
---> 60 inputs, attrs, num_outputs)
61 except core._NotOkStatusException as e:
62 if name is not None:
InvalidArgumentError: The first dimension of paddings must be the rank of inputs[4,2] [] [Op:Pad]
here is the code for that paticular part
# create the input layer (Same as the imageNetv2 input size)
inputs = tf.keras.Input(shape=input_shape)
# apply data augmentation to the inputs
x = data_augmentation(inputs)
# data preprocessing using the same weights the model was trained on
x = preprocess_input(x)
# set training to False to avoid keeping track of statistics in the batch norm layer
x = base_model(input_shape,training=False)(x)