/
glebestraikh
/
adept
Обзор
Документация
Войти
/
glebestraikh
/
adept
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
python/cpp_bindings/mnistdataset_py.cpp
19 строк
655 B
kolkir
Update mnist dataset interface in pybind
06 июл 2025, 11:53
06 июл 2025, 11:53
cf10876
Код
Авторство
О чём код?
#include <pybind11/pybind11.h> #include <pybind11/stl.h> #include <adept/data/mnistdataset.hpp> namespace py = pybind11; using namespace adept; void bind_mnistdataset(py::module& m) { py::class_<MNISTDataset, Dataset>(m, "MNISTDataset") .def(py::init<const std::string&, const std::string&, dtype_t, bool>(), py::arg("images_file"), py::arg("labels_file"), py::arg("dtype") = dtype_t::Float32, py::arg("flat") = false) .def("size", &MNISTDataset::size) .def("__len__", [](MNISTDataset& self) { return self.size(); }) .def("item", &MNISTDataset::item) .def("item_size", &MNISTDataset::item_size); }