Convert this array to numpy array Returns ------- np_arr : numpy.ndarray The corresponding numpy array.
(self)
| 243 | return str(self.asnumpy()) |
| 244 | |
| 245 | def asnumpy(self): |
| 246 | """Convert this array to numpy array |
| 247 | |
| 248 | Returns |
| 249 | ------- |
| 250 | np_arr : numpy.ndarray |
| 251 | The corresponding numpy array. |
| 252 | """ |
| 253 | t = DECORDType(self.dtype) |
| 254 | shape, dtype = self.shape, self.dtype |
| 255 | if t.lanes > 1: |
| 256 | shape = shape + (t.lanes,) |
| 257 | t.lanes = 1 |
| 258 | dtype = str(t) |
| 259 | np_arr = np.empty(shape, dtype=dtype) |
| 260 | assert np_arr.flags['C_CONTIGUOUS'] |
| 261 | data = np_arr.ctypes.data_as(ctypes.c_void_p) |
| 262 | nbytes = ctypes.c_size_t(np_arr.size * np_arr.dtype.itemsize) |
| 263 | check_call(_LIB.DECORDArrayCopyToBytes(self.handle, data, nbytes)) |
| 264 | return np_arr |
| 265 | |
| 266 | def copyto(self, target): |
| 267 | """Copy array to target |