fix(python): flatten packing buffers and package Cargo libraries
This commit is contained in:
parent
f081a808ea
commit
912a267028
1 changed files with 355 additions and 9 deletions
|
|
@ -49,7 +49,7 @@ def pack_int2(data: NDArray[numpy.integer] | Sequence[int] | int) -> bytes:
|
|||
if result != 0:
|
||||
raise ValueError(f'Invalid value for conversion to Int2: {result}')
|
||||
|
||||
i2arr = arr.view('>i2')[::arr.itemsize // 2]
|
||||
i2arr = arr.reshape(-1).view('>i2')[::arr.itemsize // 2]
|
||||
return i2arr.tobytes()
|
||||
|
||||
if arr.dtype == numpy.dtype('>i2'):
|
||||
|
|
@ -79,7 +79,7 @@ def pack_int4(data: NDArray[numpy.integer] | Sequence[int] | int) -> bytes:
|
|||
if result != 0:
|
||||
raise ValueError(f'Invalid value for conversion to Int4: {result}')
|
||||
|
||||
i4arr = arr.view('>i4')[::arr.itemsize // 4]
|
||||
i4arr = arr.reshape(-1).view('>i4')[::arr.itemsize // 4]
|
||||
return i4arr.tobytes()
|
||||
|
||||
if arr.dtype == numpy.dtype('>i4'):
|
||||
|
|
|
|||
Loading…
Reference in a new issue