Get the NumPy array, deserializing from the disk if it was stored earlier. Returns: np.ndarray: The NumPy array
(self)
| 49 | self.arr = arr |
| 50 | |
| 51 | def numpy(self): |
| 52 | """ |
| 53 | Get the NumPy array, deserializing from the disk if it was stored earlier. |
| 54 | |
| 55 | Returns: |
| 56 | np.ndarray: The NumPy array |
| 57 | """ |
| 58 | if self.arr is not None: |
| 59 | return self.arr |
| 60 | |
| 61 | assert self.tmpfile is not None, "Path and NumPy array cannot both be None!" |
| 62 | return load_json(self.tmpfile.name) |
| 63 | |
| 64 | |
| 65 | @Encoder.register(LazyNumpyArray) |