(array)
| 205 | # imported before we need to encode/decode NumPy arrays. |
| 206 | @Encoder.register(np.ndarray) |
| 207 | def encode(array): |
| 208 | outfile = io.BytesIO() |
| 209 | np.save(outfile, array, allow_pickle=False) |
| 210 | outfile.seek(0) |
| 211 | data = base64.b64encode(outfile.read()).decode() |
| 212 | return {"array": data} |
| 213 | |
| 214 | @Decoder.register(np.ndarray) |
| 215 | def decode(dct): |