mirror of
https://github.com/opencv/opencv.git
synced 2026-09-11 21:01:33 -05:00
map 64bit int anf bfloat16
This commit is contained in:
@@ -34,6 +34,14 @@ UMatData* NumpyAllocator::allocate(int dims0, const int* sizes, int type, void*
|
||||
|
||||
int depth = CV_MAT_DEPTH(type);
|
||||
int cn = CV_MAT_CN(type);
|
||||
// cvDepthToNumpyType() widens CV_16BF to NPY_FLOAT for export, which is only
|
||||
// valid when the values are converted (see pyopencv_from). Backing a CV_16BF
|
||||
// Mat with a float32 buffer here would instead pair a 2-byte element step with
|
||||
// 4-byte NumPy strides and silently corrupt the data, so refuse it outright.
|
||||
if( depth == CV_16BF )
|
||||
CV_Error(Error::StsNotImplemented,
|
||||
"CV_16BF (bfloat16) arrays cannot be allocated through the NumPy allocator: "
|
||||
"NumPy has no bfloat16 dtype");
|
||||
int typenum = cvDepthToNumpyType(depth);
|
||||
int i, dims = dims0;
|
||||
cv::AutoBuffer<npy_intp> _sizes(dims + 1);
|
||||
|
||||
Reference in New Issue
Block a user