Closed LucaMantani closed 6 months ago
Please add a unit test for this new code, ideally handling all kinds of types.
Please add a unit test for this new code, ideally handling all kinds of types.
I added a test for the encoder checking int32, float32, np.arrays and the case of a non-numpy type, would you add more tests?
verifying that it can be used with json.dump successfully would be worth adding. Maybe check the resulting json string for one or two simple cases.
json.dumps should be enough actually...
json.dumps should be enough actually...
Yes I implemented it with that.
I'll close this for now, but we can reopen it later. To avoid increased code maintenance, I'd prefer to ingest this code only if there is a strong need.
This PR adds a numpy encoder to the
json.dump
of the results, addressing the issue highlighted in the 1st comment of #135 . In particular, it now allows to run with float32 precision which is the default in JAX and often a preferred option on GPUs when speed and efficiency are relevant.