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

Merge branch 'PythonDB' into 'dev'

Python database

See merge request eclipse/aidge/aidge_core!101
parents d1d973cb 11821374
No related branches found
No related tags found
No related merge requests found
#include <pybind11/pybind11.h> #include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "aidge/data/Database.hpp" #include "aidge/data/Database.hpp"
#include "aidge/data/Tensor.hpp"
namespace py = pybind11; namespace py = pybind11;
namespace Aidge { namespace Aidge {
void init_Database(py::module& m){ /**
* @brief Trampoline class for binding
*
*/
class pyDatabase : public Database {
public:
using Database::Database; // Inherit constructors
py::class_<Database, std::shared_ptr<Database>>(m,"Database"); std::vector<std::shared_ptr<Tensor>> getItem(
const std::size_t index) const override {
PYBIND11_OVERRIDE_PURE_NAME(std::vector<std::shared_ptr<Tensor>>, Database,
"get_item", getItem, index);
}
std::size_t getLen() const noexcept override {
PYBIND11_OVERRIDE_PURE_NAME(std::size_t, Database, "len", getLen);
}
std::size_t getNbModalities() const noexcept override {
PYBIND11_OVERRIDE_PURE_NAME(std::size_t, Database, "get_nb_modalities",
getNbModalities);
}
};
void init_Database(py::module& m) {
} py::class_<Database, std::shared_ptr<Database>, pyDatabase>(
m, "Database", py::dynamic_attr())
.def(py::init<>())
.def("get_item", &Database::getItem)
.def("len", &Database::getLen)
.def("get_nb_modalities", &Database::getNbModalities);
} }
} // namespace Aidge
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