I have some data like this:
tensor([[0.9938+0.j, 0.1109+0.j],
[1.0000+0.j, 0.0000+0.j],
[0.9450+0.j, 0.3272+0.j],
[0.9253+0.j, 0.3792+0.j],
[0.9450+0.j, 0.3272+0.j],
[0.9028+0.j, 0.4300+0.j],
[0.8776+0.j, 0.4794+0.j],
[0.9253+0.j, 0.3792+0.j],
[0.9253+0.j, 0.3792+0.j],
[0.9985+0.j, 0.0555+0.j]]
and I would like to save it to a JSON file.
I have tried to convert it to string by doing data.numpy().tostring()
but it gave me an error saying TypeError: Object of type bytes is not JSON serializable
.
What is the correct way to do this? Any suggestion will be appreciated.