File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -4389,14 +4389,22 @@ def _validate_softmax_output(model_instance):
4389
4389
4390
4390
"""
4391
4391
outputs = model_instance .outputs
4392
+
4393
+ # `outputs` can be None in the case of subclassed models.
4392
4394
if outputs is not None :
4393
4395
for output in outputs :
4394
- if (
4395
- "softmax" in str (output .name .lower ())
4396
- and output .__class__ .__name__ == "KerasTensor"
4397
- ):
4398
- check_output_activation (output )
4399
4396
4397
+ # if an output layer ends with a native tf_ops the name can be None,
4398
+ # i.e using output layer: tf.cast(outputs, tf.float32)
4399
+ output_name = str (output .name )
4400
+ if output_name is not None :
4401
+ if (
4402
+ "softmax" in str (output_name .lower ())
4403
+ and output .__class__ .__name__ == "KerasTensor"
4404
+ ):
4405
+ check_output_activation (output )
4406
+ else :
4407
+ continue
4400
4408
else : # model is a subclassed/custom model, so we don't apply any checks
4401
4409
return
4402
4410
You can’t perform that action at this time.
0 commit comments