Added base capabilities for tensor in python
This commit is contained in:
parent
9559c79eee
commit
0e9ba00b71
4 changed files with 35 additions and 9 deletions
|
|
@ -1,9 +1,27 @@
|
|||
#include <pybind11/pybind11.h>
|
||||
#include "kompute/Kompute.hpp"
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
#include <kompute/Kompute.hpp>
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
PYBIND11_MODULE(cmake_example, m) {
|
||||
PYBIND11_MODULE(komputepy, m) {
|
||||
|
||||
py::enum_<kp::Tensor::TensorTypes>(m, "TensorTypes")
|
||||
.value("eDevice", kp::Tensor::TensorTypes::eDevice)
|
||||
.value("eStaging", kp::Tensor::TensorTypes::eStaging)
|
||||
.value("eStorage", kp::Tensor::TensorTypes::eStorage)
|
||||
.export_values();
|
||||
|
||||
py::class_<kp::Tensor>(m, "Tensor")
|
||||
.def(py::init(
|
||||
[](const std::vector<float>& data) {
|
||||
return std::unique_ptr<kp::Tensor>(new kp::Tensor(data));
|
||||
}))
|
||||
.def(py::init(
|
||||
[](const std::vector<float>& data, kp::Tensor::TensorTypes tensorTypes) {
|
||||
return std::unique_ptr<kp::Tensor>(new kp::Tensor(data, tensorTypes));
|
||||
}));
|
||||
|
||||
#ifdef VERSION_INFO
|
||||
m.attr("__version__") = VERSION_INFO;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue