↰ Return to documentation for file (morpheus/_lib/src/python_modules/common.cpp
)
#include "morpheus/objects/fiber_queue.hpp"
#include "morpheus/objects/file_types.hpp"
#include "morpheus/objects/filter_source.hpp"
#include "morpheus/objects/tensor_object.hpp"// for TensorObject
#include "morpheus/objects/wrapped_tensor.hpp"
#include "morpheus/utilities/cudf_util.hpp"
#include <pybind11/pybind11.h>
#include <memory>
namespace morpheus {
namespace py = pybind11;
PYBIND11_MODULE(common, m)
{
m.doc() = R"pbdoc(
-----------------------
.. currentmodule:: morpheus.common
.. autosummary::
:toctree: _generate
)pbdoc";
// Load the cudf helpers
load_cudf_helpers();
py::class_<TensorObject>(m, "Tensor")
.def_property_readonly("__cuda_array_interface__", &TensorObjectInterfaceProxy::cuda_array_interface);
py::class_<FiberQueue, std::shared_ptr<FiberQueue>>(m, "FiberQueue")
.def(py::init<>(&FiberQueueInterfaceProxy::init), py::arg("max_size"))
.def("get", &FiberQueueInterfaceProxy::get, py::arg("block") = true, py::arg("timeout") = 0.0)
.def("put", &FiberQueueInterfaceProxy::put, py::arg("item"), py::arg("block") = true, py::arg("timeout") = 0.0)
.def("close", &FiberQueueInterfaceProxy::close);
py::enum_<FileTypes>(m,
"FileTypes",
"The type of files that the `FileSourceStage` can read and `WriteToFileStage` can write. Use "
"'auto' to determine from the file extension.")
.value("Auto", FileTypes::Auto)
.value("JSON", FileTypes::JSON)
.value("CSV", FileTypes::CSV);
m.def("determine_file_type", &FileTypesInterfaceProxy::determine_file_type);
py::enum_<FilterSource>(
m, "FilterSource", "Enum to indicate which source the FilterDetectionsStage should operate on.")
.value("Auto", FilterSource::Auto)
.value("TENSOR", FilterSource::TENSOR)
.value("DATAFRAME", FilterSource::DATAFRAME);
#ifdef VERSION_INFO
m.attr("__version__") = MACRO_STRINGIFY(VERSION_INFO);
#else
m.attr("__version__") = "dev";
#endif
}
} // namespace morpheus