Commit 52bdb308 authored by André Anjos's avatar André Anjos 💬

Re-start trainer from scratch

parent 239605df
......@@ -195,6 +195,7 @@ setup(
),
Extension("xbob.learn.libsvm._library",
[
"xbob/learn/libsvm/pytrainer.cpp",
"xbob/learn/libsvm/pyfile.cpp",
"xbob/learn/libsvm/pymachine.cpp",
"xbob/learn/libsvm/main.cpp",
......
......@@ -48,24 +48,34 @@ typedef struct {
* Bindings for xbob.learn.libsvm.Machine *
******************************************/
#define PyBobLearnLibsvmMachineSvmType_Type_NUM 3
#define PyBobLearnLibsvmMachineSvmType_Type_TYPE PyTypeObject
#define PyBobLearnLibsvmMachineSvmKernelType_Type_NUM 4
#define PyBobLearnLibsvmMachineSvmKernelType_Type_TYPE PyTypeObject
typedef struct {
PyObject_HEAD
bob::learn::libsvm::Machine* cxx;
} PyBobLearnLibsvmMachineObject;
#define PyBobLearnLibsvmMachine_Type_NUM 5
#define PyBobLearnLibsvmMachine_Type_NUM 3
#define PyBobLearnLibsvmMachine_Type_TYPE PyTypeObject
#define PyBobLearnLibsvmMachine_Check_NUM 6
#define PyBobLearnLibsvmMachine_Check_NUM 4
#define PyBobLearnLibsvmMachine_Check_RET int
#define PyBobLearnLibsvmMachine_Check_PROTO (PyObject* o)
/******************************************
* Bindings for xbob.learn.libsvm.Trainer *
******************************************/
typedef struct {
PyObject_HEAD
bob::learn::libsvm::Trainer* cxx;
} PyBobLearnLibsvmTrainerObject;
#define PyBobLearnLibsvmTrainer_Type_NUM 5
#define PyBobLearnLibsvmTrainer_Type_TYPE PyTypeObject
#define PyBobLearnLibsvmTrainer_Check_NUM 6
#define PyBobLearnLibsvmTrainer_Check_RET int
#define PyBobLearnLibsvmTrainer_Check_PROTO (PyObject* o)
/* Total number of C API pointers */
#define PyXbobLearnLibsvm_API_pointers 7
......@@ -91,14 +101,18 @@ typedef struct {
* Bindings for xbob.learn.libsvm.Machine *
******************************************/
extern PyBobLearnLibsvmMachineSvmType_Type_TYPE PyBobLearnLibsvmMachineSvmType_Type;
extern PyBobLearnLibsvmMachineSvmKernelType_Type_TYPE PyBobLearnLibsvmMachineSvmKernelType_Type;
extern PyBobLearnLibsvmMachine_Type_TYPE PyBobLearnLibsvmMachine_Type;
PyBobLearnLibsvmMachine_Check_RET PyBobLearnLibsvmMachine_Check PyBobLearnLibsvmMachine_Check_PROTO;
/******************************************
* Bindings for xbob.learn.libsvm.Trainer *
******************************************/
extern PyBobLearnLibsvmTrainer_Type_TYPE PyBobLearnLibsvmTrainer_Type;
PyBobLearnLibsvmTrainer_Check_RET PyBobLearnLibsvmTrainer_Check PyBobLearnLibsvmTrainer_Check_PROTO;
#else
/* This section is used in modules that use `xbob.learn.libsvm's' C-API */
......@@ -143,14 +157,18 @@ typedef struct {
* Bindings for xbob.learn.libsvm.Machine *
******************************************/
# define PyBobLearnLibsvmMachineSvmType_Type (*(PyBobLearnLibsvmMachineSvmType_Type_TYPE *)PyXbobLearnLibsvm_API[PyBobLearnLibsvmMachineSvmType_Type_NUM])
# define PyBobLearnLibsvmMachineSvmKernelType_Type (*(PyBobLearnLibsvmMachineSvmKernelType_Type_TYPE *)PyXbobLearnLibsvm_API[PyBobLearnLibsvmMachineSvmKernelType_Type_NUM])
# define PyBobLearnLibsvmMachine_Type (*(PyBobLearnLibsvmMachine_Type_TYPE *)PyXbobLearnLibsvm_API[PyBobLearnLibsvmMachine_Type_NUM])
# define PyBobLearnLibsvmMachine_Check (*(PyBobLearnLibsvmMachine_Check_RET (*)PyBobLearnLibsvmMachine_Check_PROTO) PyXbobLearnLibsvm_API[PyBobLearnLibsvmMachine_Check_NUM])
/******************************************
* Bindings for xbob.learn.libsvm.Trainer *
******************************************/
# define PyBobLearnLibsvmTrainer_Type (*(PyBobLearnLibsvmTrainer_Type_TYPE *)PyXbobLearnLibsvm_API[PyBobLearnLibsvmTrainer_Type_NUM])
# define PyBobLearnLibsvmTrainer_Check (*(PyBobLearnLibsvmTrainer_Check_RET (*)PyBobLearnLibsvmTrainer_Check_PROTO) PyXbobLearnLibsvm_API[PyBobLearnLibsvmTrainer_Check_NUM])
# if !defined(NO_IMPORT_ARRAY)
/**
......
......@@ -39,19 +39,11 @@ static PyObject* create_module (void) {
PyBobLearnLibsvmFile_Type.tp_new = PyType_GenericNew;
if (PyType_Ready(&PyBobLearnLibsvmFile_Type) < 0) return 0;
PyBobLearnLibsvmMachineSvmType_Type.tp_new = PyType_GenericNew;
if (PyType_Ready(&PyBobLearnLibsvmMachineSvmType_Type) < 0) return 0;
PyBobLearnLibsvmMachineSvmKernelType_Type.tp_new = PyType_GenericNew;
if (PyType_Ready(&PyBobLearnLibsvmMachineSvmKernelType_Type) < 0) return 0;
PyBobLearnLibsvmMachine_Type.tp_new = PyType_GenericNew;
if (PyType_Ready(&PyBobLearnLibsvmMachine_Type) < 0) return 0;
/**
PyBobLearnLibsvmTrainer_Type.tp_new = PyType_GenericNew;
if (PyType_Ready(&PyBobLearnLibsvmTrainer_Type) < 0) return 0;
**/
# if PY_VERSION_HEX >= 0x03000000
PyObject* m = PyModule_Create(&module_definition);
......@@ -69,19 +61,11 @@ static PyObject* create_module (void) {
Py_INCREF(&PyBobLearnLibsvmFile_Type);
if (PyModule_AddObject(m, "File", (PyObject *)&PyBobLearnLibsvmFile_Type) < 0) return 0;
Py_INCREF(&PyBobLearnLibsvmMachineSvmType_Type);
if (PyModule_AddObject(m, "svm_type", (PyObject *)&PyBobLearnLibsvmMachineSvmType_Type) < 0) return 0;
Py_INCREF(&PyBobLearnLibsvmMachineSvmKernelType_Type);
if (PyModule_AddObject(m, "svm_kernel_type", (PyObject *)&PyBobLearnLibsvmMachineSvmKernelType_Type) < 0) return 0;
Py_INCREF(&PyBobLearnLibsvmMachine_Type);
if (PyModule_AddObject(m, "Machine", (PyObject *)&PyBobLearnLibsvmMachine_Type) < 0) return 0;
/**
Py_INCREF(&PyBobLearnLibsvmTrainer_Type);
if (PyModule_AddObject(m, "Trainer", (PyObject *)&PyBobLearnLibsvmTrainer_Type) < 0) return 0;
**/
static void* PyXbobLearnLibsvm_API[PyXbobLearnLibsvm_API_pointers];
......@@ -113,11 +97,9 @@ static PyObject* create_module (void) {
* Bindings for xbob.learn.libsvm.Trainer *
******************************************/
/**
PyXbobLearnLibsvm_API[PyBobLearnLibsvmTrainer_Type_NUM] = (void *)&PyBobLearnLibsvmTrainer_Type;
PyXbobLearnLibsvm_API[PyBobLearnLibsvmTrainer_Check_NUM] = (void *)&PyBobLearnLibsvmTrainer_Check;
**/
#if PY_VERSION_HEX >= 0x02070000
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment