I am finding trouble with the following error at the alpaca_model:
I would be grateful if you could help.
ValueError Traceback (most recent call last)
<ipython-input-44-11ffc7a7acb3> in <module>
----> 1 model2 = alpaca_model(IMG_SIZE, data_augmentation)
<ipython-input-43-07a7b21e40ac> in alpaca_model(image_shape, data_augmentation)
35
36 # set training to False to avoid keeping track of statistics in the batch norm layer
---> 37 x = base_model(x, training=False)
38
39 # 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)
6578
6579 def pad_eager_fallback(input, paddings, name, ctx):
-> 6580 _attr_T, (input,) = _execute.args_to_matching_eager([input], ctx)
6581 _attr_Tpaddings, (paddings,) = _execute.args_to_matching_eager([paddings], ctx, _dtypes.int32)
6582 _inputs_flat = [input, paddings]
/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/execute.py in args_to_matching_eager(l, ctx, default_dtype)
261 ret.append(
262 ops.convert_to_tensor(
--> 263 t, dtype, preferred_dtype=default_dtype, ctx=ctx))
264 if dtype is None:
265 dtype = ret[-1].dtype
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/ops.py in convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, dtype_hint, ctx, accepted_result_types)
1497
1498 if ret is None:
-> 1499 ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
1500
1501 if ret is NotImplemented:
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in _constant_tensor_conversion_function(v, dtype, name, as_ref)
336 as_ref=False):
337 _ = as_ref
--> 338 return constant(v, dtype=dtype, name=name)
339
340
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in constant(value, dtype, shape, name)
262 """
263 return _constant_impl(value, dtype, shape, name, verify_shape=False,
--> 264 allow_broadcast=True)
265
266
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in _constant_impl(value, dtype, shape, name, verify_shape, allow_broadcast)
273 with trace.Trace("tf.constant"):
274 return _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
--> 275 return _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
276
277 g = ops.get_default_graph()
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
298 def _constant_eager_impl(ctx, value, dtype, shape, verify_shape):
299 """Implementation of eager constant."""
--> 300 t = convert_to_eager_tensor(value, ctx, dtype)
301 if shape is None:
302 return t
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py in convert_to_eager_tensor(value, ctx, dtype)
96 dtype = dtypes.as_dtype(dtype).as_datatype_enum
97 ctx.ensure_initialized()
---> 98 return ops.EagerTensor(value, ctx.device_name, dtype)
99
100
ValueError: Attempt to convert a value (<function preprocess_input at 0x7fa630374a70>) with an unsupported type (<class 'function'>) to a Tensor.