I’ve tried a bunch of things and need help!
inputs.shape (None, 160, 160, 3)
type(x) = <class ‘tensorflow.python.framework.ops.Tensor’>
TypeError Traceback (most recent call last)
in
----> 1 model2 = alpaca_model(IMG_SIZE, data_augmentation)
in alpaca_model(image_shape, data_augmentation)
32 print(f"type(x) = {type(x)}")
33 # set training to False to avoid keeping track of statistics in the batch norm layer
—> 34 x = base_model(x, training=‘False’)
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)
924 if _in_functional_construction_mode(self, inputs, args, kwargs, input_list):
925 return self._functional_construction_call(inputs, args, kwargs,
→ 926 input_list)
927
928 # Maintains info about the Layer.call
stack.
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _functional_construction_call(self, inputs, args, kwargs, input_list)
1115 try:
1116 with ops.enable_auto_cast_variables(self._compute_dtype_object):
→ 1117 outputs = call_fn(cast_inputs, *args, **kwargs)
1118
1119 except errors.OperatorNotAllowedInGraphError as e:
/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)
924 if _in_functional_construction_mode(self, inputs, args, kwargs, input_list):
925 return self._functional_construction_call(inputs, args, kwargs,
→ 926 input_list)
927
928 # Maintains info about the Layer.call
stack.
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _functional_construction_call(self, inputs, args, kwargs, input_list)
1115 try:
1116 with ops.enable_auto_cast_variables(self._compute_dtype_object):
→ 1117 outputs = call_fn(cast_inputs, *args, **kwargs)
1118
1119 except errors.OperatorNotAllowedInGraphError as e:
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/layers/normalization.py in call(self, inputs, training)
718
719 if self.fused:
→ 720 outputs = self._fused_batch_norm(inputs, training=training)
721 if self.virtual_batch_size is not None:
722 # Currently never reaches here since fused_batch_norm does not support
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/layers/normalization.py in _fused_batch_norm(self, inputs, training)
575
576 output, mean, variance = tf_utils.smart_cond(training, train_op,
→ 577 _fused_batch_norm_inference)
578 variance = _maybe_add_or_remove_bessels_correction(variance, remove=True)
579
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/utils/tf_utils.py in smart_cond(pred, true_fn, false_fn, name)
63 pred, true_fn=true_fn, false_fn=false_fn, name=name)
64 return smart_module.smart_cond(
—> 65 pred, true_fn=true_fn, false_fn=false_fn, name=name)
66
67
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/smart_cond.py in smart_cond(pred, true_fn, false_fn, name)
49 raise TypeError("false_fn
must be callable.")
50
—> 51 pred_value = smart_constant_value(pred)
52 if pred_value is not None:
53 if pred_value:
/opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/smart_cond.py in smart_constant_value(pred)
86 else:
87 raise TypeError("pred
must be a Tensor, or a Python bool, or 1 or 0. "
—> 88 "Found instead: s" type(pred))
89
90 return pred_value
TypeError: pred
must be a Tensor, or a Python bool, or 1 or 0. Found instead: <class ‘str’>