Skip to content
Snippets Groups Projects
Commit 2df13807 authored by Cyril Moineau's avatar Cyril Moineau
Browse files

Add support for int64 with Numpy interrop.

parent 2ed4315d
No related branches found
No related tags found
1 merge request!67dev
......@@ -96,6 +96,8 @@ void init_Tensor(py::module& m){
return py::cast(b.get<float>(idx));
case DataType::Int32:
return py::cast(b.get<int>(idx));
case DataType::Int64:
return py::cast(b.get<long>(idx));
default:
return py::none();
}
......@@ -109,6 +111,8 @@ void init_Tensor(py::module& m){
return py::cast(b.get<float>(coordIdx));
case DataType::Int32:
return py::cast(b.get<int>(coordIdx));
case DataType::Int64:
return py::cast(b.get<long>(coordIdx));
default:
return py::none();
}
......@@ -139,6 +143,9 @@ void init_Tensor(py::module& m){
case DataType::Int32:
dataFormatDescriptor = py::format_descriptor<int>::format();
break;
case DataType::Int64:
dataFormatDescriptor = py::format_descriptor<long>::format();
break;
default:
throw py::value_error("Unsupported data format");
}
......@@ -156,6 +163,7 @@ void init_Tensor(py::module& m){
// TODO : If the ctor with the right data type does not exist, pybind will always convert the data to INT !
// Need to find a way to avoid this !
addCtor<int>(pyClassTensor);
addCtor<long>(pyClassTensor);
addCtor<float>(pyClassTensor);
// #if SIZE_MAX != 0xFFFFFFFF
addCtor<double>(pyClassTensor);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment