Updated python and cpp end to end test and readme to show support for different types on tensor
This commit is contained in:
parent
6a7f410675
commit
8abb2313d0
4 changed files with 39 additions and 27 deletions
|
|
@ -173,6 +173,7 @@ PYBIND11_MODULE(kp, m) {
|
|||
kp::Tensor::TensorTypes tensor_type) {
|
||||
const py::array_t<float>& flatdata = np.attr("ravel")(data);
|
||||
const py::buffer_info info = flatdata.request();
|
||||
KP_LOG_DEBUG("Kompute Python Manager tensor() creating tensor float with data size {}", flatdata.size());
|
||||
return self.tensor(
|
||||
info.ptr,
|
||||
flatdata.size(),
|
||||
|
|
@ -186,8 +187,10 @@ PYBIND11_MODULE(kp, m) {
|
|||
const py::array& data,
|
||||
kp::Tensor::TensorTypes tensor_type) {
|
||||
// TODO: Suppport strides in numpy format
|
||||
const py::array_t<float>& flatdata = np.attr("ravel")(data);
|
||||
const py::array& flatdata = np.attr("ravel")(data);
|
||||
const py::buffer_info info = flatdata.request();
|
||||
KP_LOG_DEBUG("Kompute Python Manager creating tensor_T with data size {} dtype {}",
|
||||
flatdata.size(), std::string(py::str(flatdata.dtype())));
|
||||
if (flatdata.dtype() == py::dtype::of<std::float_t>()) {
|
||||
return self.tensor(
|
||||
info.ptr, flatdata.size(), sizeof(float), kp::Tensor::TensorDataTypes::eFloat, tensor_type);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue