-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFeaHash_pybind.cpp
More file actions
50 lines (40 loc) · 2.04 KB
/
Copy pathFeaHash_pybind.cpp
File metadata and controls
50 lines (40 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/// file: FeaHash_pybind.cpp
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "../FeaHash_pybind.h"
namespace py = pybind11;
namespace feather {
void FeaHash_pybind(py::module& m) {
py::class_<FeaHash>(m, "FeaHash")
.def(py::init<>())
.def(py::init<const std::string&>())
.def("SlotRegister", &FeaHash::SlotRegister)
.def("FeaHash2FeaName", &FeaHash::FeaHash2FeaName)
.def("SchemaLineRegister", &FeaHash::SchemaLineRegister)
.def("Hash2IndexDictBuild", &FeaHash::Hash2IndexDictBuild)
.def("GetFeaHash",
static_cast<std::vector<int64_t> (FeaHash::*)(
const std::string&, const std::string&, uint16_t)>(&FeaHash::GetFeaHash),
py::arg("fea_name"), py::arg("fea_value"), py::arg("hash_type") = 0)
.def("GetFeaHash",
static_cast<std::vector<int64_t> (FeaHash::*)(
const std::string&, const int32_t, uint16_t)>(&FeaHash::GetFeaHash),
py::arg("fea_name"), py::arg("fea_value"), py::arg("hash_type") = 0)
.def("GetFeaHash",
static_cast<std::vector<int64_t> (FeaHash::*)(
const std::string&, const float, uint16_t)>(&FeaHash::GetFeaHash),
py::arg("fea_name"), py::arg("fea_value"), py::arg("hash_type") = 0)
.def("GetFeaHash",
static_cast<std::vector<int64_t> (FeaHash::*)(
const std::string&, const std::vector<float>&, uint16_t)>(&FeaHash::GetFeaHash),
py::arg("fea_name"), py::arg("fea_value"), py::arg("hash_type") = 0)
.def("GetFeaHash",
static_cast<std::vector<int64_t> (FeaHash::*)(
const std::string&, const std::vector<std::string>&, uint16_t)>(&FeaHash::GetFeaHash),
py::arg("fea_name"), py::arg("fea_value"), py::arg("hash_type") = 0)
.def("GetFeaHash",
static_cast<std::vector<int64_t> (FeaHash::*)(
const std::string&, const std::vector<int32_t>&, uint16_t)>(&FeaHash::GetFeaHash),
py::arg("fea_name"), py::arg("fea_value"), py::arg("hash_type") = 0);
}
} // namespace feather