我想将 C(Swig) 中的 numpy double 数组转换为 numpy float 数组。我正在尝试使用
PyObject *object = PyArray_FROM_OT(input,NPY_FLOAT)
Run Code Online (Sandbox Code Playgroud)
或者
PyObject *object = PyArray_FROMANY(input,NPY_FLOAT,0,0,NPY_DEFAULT)
Run Code Online (Sandbox Code Playgroud)
或者
PyObject *object = PyArray_FromObject(input,NPY_FLOAT,0,0)
Run Code Online (Sandbox Code Playgroud)
或者
PyObject *object = PyArray_ContiguousFromAny(input,NPY_FLOAT,0,0)
Run Code Online (Sandbox Code Playgroud)
但它们都返回NULL?我错过了什么吗?