Error encoding <class 'numpy.float32'>

Hello!!

I am wondering why I get the error below when I try to store a numpy object (from a tensor object coverted with .numpy()) with pymongo:

bson.errors.InvalidDocument: cannot encode object: 0.5365428, of type: <class ‘numpy.float32’>

If I apply float() to this <class ‘numpy.float32’>, it gets stored but it feels like I am doing twice the same thing. Moreover, I am told that .numpy() should be the best practice when converting from a tensor object.

Thank you!!

Best regards,
Monica