TF 2.13.0 gets Unrecognized type class EagerTensor

I’m in the final stages of getting a Faster-R-CNN model working, it builds, it trains, it even infers, but when I try to save it gives the cryptic message…
TypeError: Unable to serialize 60 to JSON. Unrecognized type <class ‘tensorflow.python.framework.ops.EagerTensor’>. No clues as to which layer is causing this.

This is with Python 3.8.10 and TensorFlow 2.13.0. I tried turning on “tf.debugging.disable_traceback_filtering()”, but still no information.

Suggestions welcome!


I think JSON serialization does have a problem with both tensors and float32’s if I recall correctly. Have you tried to numpy() your outputs/inputs? That will also default them to float64.

Maybe this SO answer helps you:

I was able to put tf.range into a keras layer class, and the model can save now. Thanks!