MCPcopy Create free account
hub / github.com/OpenMined/TenSEAL / bind_plain_tensor

Function bind_plain_tensor

tenseal/binding.cpp:121–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119
120template <typename plain_t>
121void bind_plain_tensor(py::module &m, const std::string &name) {
122 using type = PlainTensor<plain_t>;
123 std::string class_name = "PlainTensor" + name;
124
125 py::class_<type>(m, class_name.c_str(), py::module_local())
126 .def(py::init<const vector<plain_t> &>())
127 .def(py::init<const vector<vector<plain_t>> &>())
128 .def(py::init<const vector<plain_t> &, const vector<size_t> &>())
129 .def(py::init<const string &>())
130 .def("at", &type::at)
131 .def("get_diagonal", &type::get_diagonal)
132 .def("horizontal_scan", &type::horizontal_scan)
133 .def("vertical_scan", &type::vertical_scan)
134 .def("data", &type::data)
135 .def("shape", &type::shape)
136 .def("strides", &type::strides)
137 .def("size", &type::size)
138 .def("batch", &type::batch)
139 .def("reshape", &type::reshape)
140 .def("reshape_", &type::reshape_inplace)
141 .def("__len__", &type::size)
142 .def("empty", &type::empty)
143 .def("replicate", &type::replicate)
144 .def("broadcast", &type::broadcast)
145 .def("broadcast_", &type::broadcast_inplace)
146 .def("transpose", &type::transpose)
147 .def("transpose_", &type::transpose_inplace)
148 .def("serialize", [](type &obj) { return py::bytes(obj.save()); });
149}
150
151void bind_bfv_vector(py::module &m) {
152 m.def("bfv_parameters", &create_bfv_parameters,

Callers

nothing calls this directly

Calls 1

saveMethod · 0.45

Tested by

no test coverage detected