Skip to content
Snippets Groups Projects
Commit e6c1c7fb authored by Nathan Thoumine's avatar Nathan Thoumine
Browse files

add docstring for user functions

parent 41161cd8
No related branches found
No related tags found
No related merge requests found
......@@ -21,14 +21,69 @@ void init_Graph(py::module& m)
.def(py::init<std::string, unsigned int, int>(),
py::arg("filepath") = "",
py::arg("device_id") = 0,
py::arg("nb_bits") = -32)
py::arg("nb_bits") = -32,
R"mydelimiter(
Construct a new Graph object.
:param filepath: Path to the file to load (default is empty).
:type filepath: str
:param device_id: Device ID to use (default is 0).
:type device_id: unsigned int
:param nb_bits: Number of bits for data (default is -32).
:type nb_bits: int
)mydelimiter")
.def("device", &Graph::device, py::arg("id"))
.def("load", &Graph::load, py::arg("filepath"))
.def("save", &Graph::save, py::arg("filepath"))
.def("calibrate", &Graph::calibrate, py::arg("calibration_folder_path") = "./calibration_folder/", py::arg("cache_file_path") = "./calibration_cache", py::arg("batch_size") = 1)
.def("initialize", &Graph::initialize)
.def("profile", &Graph::profile, py::arg("nb_iterations"), py::arg("mode")= ExecutionMode_T::ASYNC)
.def("device", &Graph::device, py::arg("id"),
R"mydelimiter(
Set the CUDA device.
:param id: Device ID.
:type id: unsigned int
)mydelimiter")
.def("load", &Graph::load, py::arg("filepath"),
R"mydelimiter(
Load graph from a file.
:param filepath: Path to the file.
:type filepath: str
)mydelimiter")
.def("save", &Graph::save, py::arg("filepath"),
R"mydelimiter(
Save graph to a file.
:param filepath: Path to the file.
:type filepath: str
)mydelimiter")
.def("calibrate", &Graph::calibrate, py::arg("calibration_folder_path") = "./calibration_folder/", py::arg("cache_file_path") = "./calibration_cache", py::arg("batch_size") = 1,
R"mydelimiter(
Calibrate the graph using the calibration data found inside the `calibration` folder.
:param calibration_folder_path: Path to the calibration folder.
:type calibration_folder_path: str
:param cache_file_path: Path to the cache file.
:type cache_file_path: str
:param batch_size: Batch size for calibration (default is 1).
:type batch_size: int
)mydelimiter")
.def("initialize", &Graph::initialize,
R"mydelimiter(
Initialize the graph.
)mydelimiter")
.def("profile", &Graph::profile, py::arg("nb_iterations"), py::arg("mode")= ExecutionMode_T::ASYNC,
R"mydelimiter(
Profile the graph's execution by printing the average profiled TensorRT process time per stimulus.
:param nb_iterations: Number of iterations for profiling.
:type nb_iterations: unsigned int
:param mode: Execution mode (SYNC or ASYNC, default is ASYNC).
:type mode: ExecutionMode_T
)mydelimiter")
.def("run_sync", [](Graph& graph, py::list inputs) -> py::list {
py::list outputs;
std::vector<void *> bufferIn;
......@@ -65,8 +120,17 @@ void init_Graph(py::module& m)
outputs.append(processed_array);
}
return outputs;
}, py::arg("inputs"))
;
}, py::arg("inputs"),
R"mydelimiter(
Run the graph.
:param inputs: Input data.
:type inputs: list
:param outputs: Output data.
:type outputs: list
:param mode: Execution mode (SYNC or ASYNC, default is ASYNC).
:type mode: ExecutionMode_T
)mydelimiter");
}
PYBIND11_MODULE(aidge_trt, m)
......
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