Use PyLong_AsVoidPtr
, PyLong_FromVoidPtr
for conversion
Use PyLong_AsVoidPtr, PyLong_FromVoidPtr to convert the pointer. Use of PyInt_AsLong returns a long which will truncate the pointer on a LLP64 target (i.e. Windows). Using PyLong_AsVoidPtr will return a void * for the Python integer or long integer. Define the corresponding "out" map which specifies the conversion to wrap the return value of a function returning a TfLiteDelegate *. This ensures that the conversion is always valid as the value is constructed fro the PyLong_FromVoidPtr.
This commit is contained in:
parent
e7badb16d0
commit
f235cc38fa
@ -29,6 +29,10 @@ limitations under the License.
|
||||
$1 = reinterpret_cast<TfLiteDelegate*>(PyLong_AsVoidPtr($input));
|
||||
}
|
||||
|
||||
%typemap(out) TfLiteDelegate* {
|
||||
$result = PyLong_FromVoidPtr($1)
|
||||
}
|
||||
|
||||
|
||||
%include "tensorflow/lite/python/interpreter_wrapper/interpreter_wrapper.h"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user