You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Operator.save_scales crashes with TypeError: Object of type float32 is not JSON serializable #41
low/high come from ndarray.min()/ndarray.max() in save_inputs_and_ref_outputs (key_to_range[inp_tensor.name] = (inp_data.min(), inp_data.max())), so they are NumPy scalars, not Python floats. abs()/max()// on NumPy scalars return a NumPy scalar too, so scale stays a numpy.float32/float64. json.dumps cannot serialize that:
TypeError: Object of type float32 is not JSON serializable
Repro
This is 100% reproducible by just running the op reconstruction test suite as documented (python operators/test.py) — it crashes on the very first operator (Neg), confirmed locally.
Fix
Wrap scale in float(...) the same way min/max already are.
Activity