Remove trace messages

This commit is contained in:
2023-11-06 23:44:33 +01:00
parent ec68e142ac
commit 472f51daf6
4 changed files with 4 additions and 26 deletions

View File

@@ -1,6 +1,5 @@
#include "PyClassifier.h"
#include "numpy/arrayobject.h"
#include <iostream>
namespace pywrap {
namespace bp = boost::python;
@@ -12,9 +11,7 @@ namespace pywrap {
}
PyClassifier::~PyClassifier()
{
std::cout << "Cleaning Classifier" << std::endl;
pyWrap->clean(module, className);
std::cout << "Classifier cleaned" << std::endl;
}
np::ndarray tensor2numpy(torch::Tensor& X)
{
@@ -52,13 +49,12 @@ namespace pywrap {
auto Xn = tensor2numpy(X);
CPyObject Xp = bp::incref(bp::object(Xn).ptr());
PyObject* incoming = pyWrap->predict(module, className, Xp);
std::cout << "Return from predict" << std::endl;
bp::handle<> handle(incoming);
bp::object object(handle);
np::ndarray prediction = np::from_object(object);
if (PyErr_Occurred()) {
PyErr_Print();
throw std::runtime_error("Error cleaning module " + module + " and class " + className);
throw std::runtime_error("Error creating object for predict in " + module + " and class " + className);
}
int* data = reinterpret_cast<int*>(prediction.get_data());
std::vector<int> v1(data, data + prediction.shape(0));