Commit 03133617 authored by André Anjos's avatar André Anjos 💬
Browse files

xbob -> bob

parent 1da8fb2c
......@@ -25,8 +25,8 @@ install:
- "python bootstrap.py"
- "CFLAGS=-coverage ./bin/buildout"
script:
- "./bin/python -c 'from xbob.learn.mlp import get_config; print(get_config())'"
- "./bin/coverage run --source=xbob.learn.mlp ./bin/nosetests -sv"
- "./bin/python -c 'from bob.learn.mlp import get_config; print(get_config())'"
- "./bin/coverage run --source=bob.learn.mlp ./bin/nosetests -sv"
- "./bin/sphinx-build -b doctest doc sphinx"
- "./bin/sphinx-build -b html doc sphinx"
after_success:
......
include LICENSE README.rst bootstrap.py buildout.cfg
recursive-include doc conf.py *.rst
recursive-include xbob *.cpp *.h
recursive-include bob *.cpp *.h
......@@ -2,16 +2,16 @@
.. Andre Anjos <andre.anjos@idiap.ch>
.. Thu 24 Apr 17:24:10 2014 CEST
.. image:: https://travis-ci.org/bioidiap/xbob.learn.mlp.svg?branch=master
:target: https://travis-ci.org/bioidiap/xbob.learn.mlp
.. image:: https://coveralls.io/repos/bioidiap/xbob.learn.mlp/badge.png
:target: https://coveralls.io/r/bioidiap/xbob.learn.mlp
.. image:: http://img.shields.io/github/tag/bioidiap/xbob.learn.mlp.png
:target: https://github.com/bioidiap/xbob.learn.mlp
.. image:: http://img.shields.io/pypi/v/xbob.learn.mlp.png
:target: https://pypi.python.org/pypi/xbob.learn.mlp
.. image:: http://img.shields.io/pypi/dm/xbob.learn.mlp.png
:target: https://pypi.python.org/pypi/xbob.learn.mlp
.. image:: https://travis-ci.org/bioidiap/bob.learn.mlp.svg?branch=master
:target: https://travis-ci.org/bioidiap/bob.learn.mlp
.. image:: https://coveralls.io/repos/bioidiap/bob.learn.mlp/badge.png
:target: https://coveralls.io/r/bioidiap/bob.learn.mlp
.. image:: http://img.shields.io/github/tag/bioidiap/bob.learn.mlp.png
:target: https://github.com/bioidiap/bob.learn.mlp
.. image:: http://img.shields.io/pypi/v/bob.learn.mlp.png
:target: https://pypi.python.org/pypi/bob.learn.mlp
.. image:: http://img.shields.io/pypi/dm/bob.learn.mlp.png
:target: https://pypi.python.org/pypi/bob.learn.mlp
===============================================================
Python bindings for Bob's Multi-Layer Perceptron and Trainers
......@@ -41,7 +41,7 @@ Testing
You can run a set of tests using the nose test runner::
$ nosetests -sv xbob.learn.mlp
$ nosetests -sv bob.learn.mlp
.. warning::
......@@ -58,7 +58,7 @@ You can run our documentation tests using sphinx itself::
You can test overall test coverage with::
$ nosetests --with-coverage --cover-package=xbob.learn.mlp
$ nosetests --with-coverage --cover-package=bob.learn.mlp
The ``coverage`` egg must be installed for this to work properly.
......
......@@ -7,10 +7,10 @@
* Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
*/
#define XBOB_LEARN_MLP_MODULE
#include <xbob.blitz/cppapi.h>
#include <xbob.blitz/cleanup.h>
#include <xbob.learn.mlp/api.h>
#define BOB_LEARN_MLP_MODULE
#include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h>
#include <bob.learn.mlp/api.h>
#include <structmember.h>
#include "utils.h"
......@@ -19,7 +19,7 @@
* Implementation of BackProp trainer *
**************************************/
PyDoc_STRVAR(s_trainer_str, XBOB_EXT_MODULE_PREFIX ".BackProp");
PyDoc_STRVAR(s_trainer_str, BOB_EXT_MODULE_PREFIX ".BackProp");
PyDoc_STRVAR(s_trainer_doc,
"BackProp(batch_size, cost, [trainer, [train_biases]]) -> new BackProp\n\
......@@ -46,10 +46,10 @@ batch_size, int\n\
\n\
This setting affects the convergence.\n\
\n\
cost, :py:class:`xbob.learn.mlp.Cost`\n\
cost, :py:class:`bob.learn.mlp.Cost`\n\
An object that can calculate the cost at every iteration.\n\
\n\
machine, :py:class:`xbob.learn.mlp.Machine`\n\
machine, :py:class:`bob.learn.mlp.Machine`\n\
This parameter that will be used as a basis for this trainer's\n\
internal properties (cache sizes, for instance).\n\
\n\
......@@ -57,7 +57,7 @@ train_biases, bool\n\
A boolean indicating if we should train the biases weights (set\n\
it to ``True``) or not (set it to ``False``).\n\
\n\
other, :py:class:`xbob.learn.mlp.Trainer`\n\
other, :py:class:`bob.learn.mlp.Trainer`\n\
Another trainer from which this new copy will get its properties\n\
from. If you use this constructor than a new (deep) copy of the\n\
trainer is created.\n\
......@@ -395,7 +395,7 @@ thrown.\n\
\n\
The machine is **not** initialized randomly at each call to this\n\
method. It is your task to call\n\
:py:meth:`xbob.learn.mlp.Machine.randomize` once at the machine\n\
:py:meth:`bob.learn.mlp.Machine.randomize` once at the machine\n\
you want to train and then call this method as many times as you\n\
think is necessary. This design allows for a *stopping criteria*\n\
to be encoded outside the scope of this trainer and for this method\n\
......@@ -405,9 +405,9 @@ thrown.\n\
\n\
Keyword arguments:\n\
\n\
machine, :py:class:`xbob.learn.mlp.Machine`\n\
machine, :py:class:`bob.learn.mlp.Machine`\n\
The machine that will be trained. You must have called\n\
:py:meth:`xbob.learn.mlp.Trainer.initialize` which a similarly\n\
:py:meth:`bob.learn.mlp.Trainer.initialize` which a similarly\n\
configured machine before being able to call this method, or an\n\
exception may be thrown.\n\
\n\
......
......@@ -7,11 +7,11 @@
* Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
*/
#define XBOB_LEARN_MLP_MODULE
#include <xbob.blitz/cppapi.h>
#include <xbob.blitz/cleanup.h>
#include <xbob.learn.mlp/api.h>
#include <xbob.learn.activation/api.h>
#define BOB_LEARN_MLP_MODULE
#include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h>
#include <bob.learn.mlp/api.h>
#include <bob.learn.activation/api.h>
#include <structmember.h>
#include <boost/function.hpp>
#include <boost/bind.hpp>
......@@ -20,7 +20,7 @@
* Implementation of Cost base class *
*************************************/
PyDoc_STRVAR(s_cost_str, XBOB_EXT_MODULE_PREFIX ".Cost");
PyDoc_STRVAR(s_cost_str, BOB_EXT_MODULE_PREFIX ".Cost");
PyDoc_STRVAR(s_cost_doc,
"A base class for evaluating the performance cost.\n\
......@@ -80,7 +80,7 @@ PyObject* PyBobLearnCost_Repr(PyBobLearnCostObject* self) {
/**
* Expected output:
*
* <xbob.learn.linear.Cost [...]>
* <bob.learn.linear.Cost [...]>
*/
auto retval = PyUnicode_FromFormat("<%s [act: %s]>",
......@@ -503,7 +503,7 @@ PyTypeObject PyBobLearnCost_Type = {
PyBobLearnCost_new, /* tp_new */
};
PyDoc_STRVAR(s_squareerror_str, XBOB_EXT_MODULE_PREFIX ".SquareError");
PyDoc_STRVAR(s_squareerror_str, BOB_EXT_MODULE_PREFIX ".SquareError");
PyDoc_STRVAR(s_squareerror_doc,
"SquareError(actfun) -> new SquareError functor\n\
......@@ -604,7 +604,7 @@ PyTypeObject PyBobLearnSquareError_Type = {
(initproc)PyBobLearnSquareError_init, /* tp_init */
};
PyDoc_STRVAR(s_crossentropyloss_str, XBOB_EXT_MODULE_PREFIX ".CrossEntropyLoss");
PyDoc_STRVAR(s_crossentropyloss_str, BOB_EXT_MODULE_PREFIX ".CrossEntropyLoss");
PyDoc_STRVAR(s_crossentropyloss_doc,
"CrossEntropyLoss(actfun) -> new CrossEntropyLoss functor\n\
......@@ -623,7 +623,7 @@ Keyword arguments:\n\
\n\
actfun\n\
The activation function object used at the last layer. If you\n\
set this to :py:class:`xbob.learn.activation.Logistic`, a\n\
set this to :py:class:`bob.learn.activation.Logistic`, a\n\
mathematical simplification is possible in which\n\
``backprop_error()`` can benefit increasing the numerical\n\
stability of the training process. The simplification goes\n\
......@@ -689,7 +689,7 @@ PyDoc_STRVAR(s_logistic_activation_doc,
"o.logistic_activation() -> bool\n\
\n\
Tells if this functor is set to operate together with a\n\
:py:class:`xbob.learn.activation.Logistic` activation function.\n\
:py:class:`bob.learn.activation.Logistic` activation function.\n\
");
static PyObject* PyBobLearnCrossEntropyLoss_getLogisticActivation
......
......@@ -12,7 +12,7 @@
#include <bob/core/check.h>
#include <bob/math/linear.h>
#include <xbob.learn.mlp/backprop.h>
#include <bob.learn.mlp/backprop.h>
bob::learn::mlp::BackProp::BackProp(size_t batch_size,
boost::shared_ptr<bob::learn::mlp::Cost> cost):
......
......@@ -7,7 +7,7 @@
* Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
*/
#include <xbob.learn.mlp/cross_entropy.h>
#include <bob.learn.mlp/cross_entropy.h>
namespace bob { namespace learn { namespace mlp {
......
......@@ -17,7 +17,7 @@
#include <bob/core/assert.h>
#include <bob/math/linear.h>
#include <xbob.learn.mlp/machine.h>
#include <bob.learn.mlp/machine.h>
bob::learn::mlp::Machine::Machine (size_t input, size_t output):
m_input_sub(input),
......
......@@ -5,7 +5,7 @@
* Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland
*/
#include <xbob.learn.mlp/roll.h>
#include <bob.learn.mlp/roll.h>
int bob::learn::mlp::detail::getNbParameters(const bob::learn::mlp::Machine& machine)
{
......
......@@ -13,7 +13,7 @@
#include <bob/core/array_copy.h>
#include <bob/math/linear.h>
#include <xbob.learn.mlp/rprop.h>
#include <bob.learn.mlp/rprop.h>
bob::learn::mlp::RProp::RProp(size_t batch_size,
boost::shared_ptr<bob::learn::mlp::Cost> cost):
......
......@@ -14,7 +14,7 @@
#include <bob/core/assert.h>
#include <bob/core/array_copy.h>
#include <xbob.learn.mlp/shuffler.h>
#include <bob.learn.mlp/shuffler.h>
bob::learn::mlp::DataShuffler::DataShuffler
(const std::vector<blitz::Array<double,2> >& data,
......
......@@ -9,7 +9,7 @@
#include <cmath>
#include <xbob.learn.mlp/square_error.h>
#include <bob.learn.mlp/square_error.h>
namespace bob { namespace learn { namespace mlp {
......
......@@ -11,7 +11,7 @@
#include <bob/core/check.h>
#include <bob/math/linear.h>
#include <xbob.learn.mlp/trainer.h>
#include <bob.learn.mlp/trainer.h>
bob::learn::mlp::Trainer::Trainer(size_t batch_size,
boost::shared_ptr<bob::learn::mlp::Cost> cost):
......
......@@ -3,12 +3,12 @@
* @date Thu 24 Apr 17:32:07 2014 CEST
*/
#ifndef XBOB_LEARN_MLP_H
#define XBOB_LEARN_MLP_H
#ifndef BOB_LEARN_MLP_H
#define BOB_LEARN_MLP_H
#include <Python.h>
#include <boost/shared_ptr.hpp>
#include <xbob.learn.mlp/config.h>
#include <bob.learn.mlp/config.h>
#include "machine.h"
#include "cost.h"
......@@ -19,8 +19,8 @@
#include "backprop.h"
#include "rprop.h"
#define XBOB_LEARN_MLP_MODULE_PREFIX xbob.learn.mlp
#define XBOB_LEARN_MLP_MODULE_NAME _library
#define BOB_LEARN_MLP_MODULE_PREFIX bob.learn.mlp
#define BOB_LEARN_MLP_MODULE_NAME _library
/*******************
* C API functions *
......@@ -28,20 +28,20 @@
/* Enum defining entries in the function table */
enum _PyBobLearnMLP_ENUM {
PyXbobLearnMLP_APIVersion_NUM = 0,
// Bindings for xbob.learn.mlp.Machine
PyBobLearnMLP_APIVersion_NUM = 0,
// Bindings for bob.learn.mlp.Machine
PyBobLearnMLPMachine_Type_NUM,
PyBobLearnMLPMachine_Check_NUM,
// Bindings for xbob.learn.mlp.Cost and variants
// Bindings for bob.learn.mlp.Cost and variants
PyBobLearnCost_Type_NUM,
PyBobLearnCost_Check_NUM,
PyBobLearnCost_NewFromCost_NUM,
PyBobLearnSquareError_Type_NUM,
PyBobLearnCrossEntropyLoss_Type_NUM,
// Bindings for xbob.learn.mlp.DataShuffler
// Bindings for bob.learn.mlp.DataShuffler
PyBobLearnDataShuffler_Type_NUM,
PyBobLearnDataShuffler_Check_NUM,
// Bindings for xbob.learn.mlp.Trainer
// Bindings for bob.learn.mlp.Trainer
PyBobLearnMLPTrainer_Type_NUM,
PyBobLearnMLPTrainer_Check_NUM,
PyBobLearnMLPBackProp_Type_NUM,
......@@ -49,17 +49,17 @@ enum _PyBobLearnMLP_ENUM {
PyBobLearnMLPRProp_Type_NUM,
PyBobLearnMLPRProp_Check_NUM,
// Total number of C API pointers
PyXbobLearnMLP_API_pointers
PyBobLearnMLP_API_pointers
};
/**************
* Versioning *
**************/
#define PyXbobLearnMLP_APIVersion_TYPE int
#define PyBobLearnMLP_APIVersion_TYPE int
/***************************************
* Bindings for xbob.learn.mlp.Machine *
* Bindings for bob.learn.mlp.Machine *
***************************************/
typedef struct {
......@@ -110,7 +110,7 @@ typedef struct {
#define PyBobLearnDataShuffler_Check_PROTO (PyObject* o)
/***************************************
* Bindings for xbob.learn.mlp.Trainer *
* Bindings for bob.learn.mlp.Trainer *
***************************************/
typedef struct {
......@@ -143,18 +143,18 @@ typedef struct {
#define PyBobLearnMLPRProp_Check_RET int
#define PyBobLearnMLPRProp_Check_PROTO (PyObject* o)
#ifdef XBOB_LEARN_MLP_MODULE
#ifdef BOB_LEARN_MLP_MODULE
/* This section is used when compiling `xbob.learn.mlp' itself */
/* This section is used when compiling `bob.learn.mlp' itself */
/**************
* Versioning *
**************/
extern int PyXbobLearnMLP_APIVersion;
extern int PyBobLearnMLP_APIVersion;
/***************************************
* Bindings for xbob.learn.mlp.Machine *
* Bindings for bob.learn.mlp.Machine *
***************************************/
extern PyBobLearnMLPMachine_Type_TYPE PyBobLearnMLPMachine_Type;
......@@ -162,7 +162,7 @@ typedef struct {
PyBobLearnMLPMachine_Check_RET PyBobLearnMLPMachine_Check PyBobLearnMLPMachine_Check_PROTO;
/************************************
* Bindings for xbob.learn.mlp.Cost *
* Bindings for bob.learn.mlp.Cost *
************************************/
extern PyBobLearnCost_Type_TYPE PyBobLearnCost_Type;
......@@ -176,7 +176,7 @@ typedef struct {
PyBobLearnCost_NewFromCost_RET PyBobLearnCost_NewFromCost PyBobLearnCost_NewFromCost_PROTO;
/********************************************
* Bindings for xbob.learn.mlp.DataShuffler *
* Bindings for bob.learn.mlp.DataShuffler *
********************************************/
extern PyBobLearnDataShuffler_Type_TYPE PyBobLearnDataShuffler_Type;
......@@ -184,7 +184,7 @@ typedef struct {
PyBobLearnDataShuffler_Check_RET PyBobLearnDataShuffler_Check PyBobLearnDataShuffler_Check_PROTO;
/***************************************
* Bindings for xbob.learn.mlp.Trainer *
* Bindings for bob.learn.mlp.Trainer *
***************************************/
extern PyBobLearnMLPTrainer_Type_TYPE PyBobLearnMLPTrainer_Type;
......@@ -201,7 +201,7 @@ typedef struct {
#else
/* This section is used in modules that use `xbob.learn.mlp's' C-API */
/* This section is used in modules that use `bob.learn.mlp's' C-API */
/************************************************************************
* Macros to avoid symbol collision and allow for separate compilation. *
......@@ -210,18 +210,18 @@ typedef struct {
************************************************************************/
# if defined(PY_ARRAY_UNIQUE_SYMBOL)
# define XBOB_LEARN_MLP_MAKE_API_NAME_INNER(a) XBOB_LEARN_MLP_ ## a
# define XBOB_LEARN_MLP_MAKE_API_NAME(a) XBOB_LEARN_MLP_MAKE_API_NAME_INNER(a)
# define PyXbobLearnMLP_API XBOB_LEARN_MLP_MAKE_API_NAME(PY_ARRAY_UNIQUE_SYMBOL)
# define BOB_LEARN_MLP_MAKE_API_NAME_INNER(a) BOB_LEARN_MLP_ ## a
# define BOB_LEARN_MLP_MAKE_API_NAME(a) BOB_LEARN_MLP_MAKE_API_NAME_INNER(a)
# define PyBobLearnMLP_API BOB_LEARN_MLP_MAKE_API_NAME(PY_ARRAY_UNIQUE_SYMBOL)
# endif
# if defined(NO_IMPORT_ARRAY)
extern void **PyXbobLearnMLP_API;
extern void **PyBobLearnMLP_API;
# else
# if defined(PY_ARRAY_UNIQUE_SYMBOL)
void **PyXbobLearnMLP_API;
void **PyBobLearnMLP_API;
# else
static void **PyXbobLearnMLP_API=NULL;
static void **PyBobLearnMLP_API=NULL;
# endif
# endif
......@@ -229,53 +229,53 @@ typedef struct {
* Versioning *
**************/
# define PyXbobLearnMLP_APIVersion (*(PyXbobLearnMLP_APIVersion_TYPE *)PyXbobLearnMLP_API[PyXbobLearnMLP_APIVersion_NUM])
# define PyBobLearnMLP_APIVersion (*(PyBobLearnMLP_APIVersion_TYPE *)PyBobLearnMLP_API[PyBobLearnMLP_APIVersion_NUM])
/***************************************
* Bindings for xbob.learn.mlp.Machine *
* Bindings for bob.learn.mlp.Machine *
***************************************/
# define PyBobLearnMLPMachine_Type (*(PyBobLearnMLPMachine_Type_TYPE *)PyXbobLearnMLP_API[PyBobLearnMLPMachine_Type_NUM])
# define PyBobLearnMLPMachine_Type (*(PyBobLearnMLPMachine_Type_TYPE *)PyBobLearnMLP_API[PyBobLearnMLPMachine_Type_NUM])
# define PyBobLearnMLPMachine_Check (*(PyBobLearnMLPMachine_Check_RET (*)PyBobLearnMLPMachine_Check_PROTO) PyXbobLearnMLP_API[PyBobLearnMLPMachine_Check_NUM])
# define PyBobLearnMLPMachine_Check (*(PyBobLearnMLPMachine_Check_RET (*)PyBobLearnMLPMachine_Check_PROTO) PyBobLearnMLP_API[PyBobLearnMLPMachine_Check_NUM])
/************************************
* Bindings for xbob.learn.mlp.Cost *
* Bindings for bob.learn.mlp.Cost *
************************************/
# define PyBobLearnCost_Type (*(PyBobLearnCost_Type_TYPE *)PyXbobLearnMLP_API[PyBobLearnCost_Type_NUM])
# define PyBobLearnCost_Type (*(PyBobLearnCost_Type_TYPE *)PyBobLearnMLP_API[PyBobLearnCost_Type_NUM])
# define PyBobLearnCost_Check (*(PyBobLearnCost_Check_RET (*)PyBobLearnCost_Check_PROTO) PyXbobLearnMLP_API[PyBobLearnCost_Check_NUM])
# define PyBobLearnCost_Check (*(PyBobLearnCost_Check_RET (*)PyBobLearnCost_Check_PROTO) PyBobLearnMLP_API[PyBobLearnCost_Check_NUM])
# define PyBobLearnCost_NewFromCost (*(PyBobLearnCost_NewFromCost_RET (*)PyBobLearnCost_NewFromCost_PROTO) PyXbobLearnMLP_API[PyBobLearnCost_NewFromCost_NUM])
# define PyBobLearnCost_NewFromCost (*(PyBobLearnCost_NewFromCost_RET (*)PyBobLearnCost_NewFromCost_PROTO) PyBobLearnMLP_API[PyBobLearnCost_NewFromCost_NUM])
# define PyBobLearnSquareError_Type (*(PyBobLearnSquareError_Type_TYPE *)PyXbobLearnMLP_API[PyBobLearnSquareError_Type_NUM])
# define PyBobLearnSquareError_Type (*(PyBobLearnSquareError_Type_TYPE *)PyBobLearnMLP_API[PyBobLearnSquareError_Type_NUM])
# define PyBobLearnCrossEntropyLoss_Type (*(PyBobLearnCrossEntropyLoss_Type_TYPE *)PyXbobLearnMLP_API[PyBobLearnCrossEntropyLoss_Type_NUM])
# define PyBobLearnCrossEntropyLoss_Type (*(PyBobLearnCrossEntropyLoss_Type_TYPE *)PyBobLearnMLP_API[PyBobLearnCrossEntropyLoss_Type_NUM])
/********************************************
* Bindings for xbob.learn.mlp.DataShuffler *
* Bindings for bob.learn.mlp.DataShuffler *
********************************************/
# define PyBobLearnDataShuffler_Type (*(PyBobLearnDataShuffler_Type_TYPE *)PyXbobLearnMLP_API[PyBobLearnDataShuffler_Type_NUM])
# define PyBobLearnDataShuffler_Type (*(PyBobLearnDataShuffler_Type_TYPE *)PyBobLearnMLP_API[PyBobLearnDataShuffler_Type_NUM])
# define PyBobLearnDataShuffler_Check (*(PyBobLearnDataShuffler_Check_RET (*)PyBobLearnDataShuffler_Check_PROTO) PyXbobLearnMLP_API[PyBobLearnDataShuffler_Check_NUM])
# define PyBobLearnDataShuffler_Check (*(PyBobLearnDataShuffler_Check_RET (*)PyBobLearnDataShuffler_Check_PROTO) PyBobLearnMLP_API[PyBobLearnDataShuffler_Check_NUM])
/***************************************
* Bindings for xbob.learn.mlp.Trainer *
* Bindings for bob.learn.mlp.Trainer *
***************************************/
# define PyBobLearnMLPTrainer_Type (*(PyBobLearnMLPTrainer_Type_TYPE *)PyXbobLearnMLP_API[PyBobLearnMLPTrainer_Type_NUM])
# define PyBobLearnMLPTrainer_Type (*(PyBobLearnMLPTrainer_Type_TYPE *)PyBobLearnMLP_API[PyBobLearnMLPTrainer_Type_NUM])
# define PyBobLearnMLPTrainer_Check (*(PyBobLearnMLPTrainer_Check_RET (*)PyBobLearnMLPTrainer_Check_PROTO) PyXbobLearnMLP_API[PyBobLearnMLPTrainer_Check_NUM])
# define PyBobLearnMLPTrainer_Check (*(PyBobLearnMLPTrainer_Check_RET (*)PyBobLearnMLPTrainer_Check_PROTO) PyBobLearnMLP_API[PyBobLearnMLPTrainer_Check_NUM])
# define PyBobLearnMLPBackProp_Type (*(PyBobLearnMLPBackProp_Type_TYPE *)PyXbobLearnMLP_API[PyBobLearnMLPBackProp_Type_NUM])
# define PyBobLearnMLPBackProp_Type (*(PyBobLearnMLPBackProp_Type_TYPE *)PyBobLearnMLP_API[PyBobLearnMLPBackProp_Type_NUM])
# define PyBobLearnMLPBackProp_Check (*(PyBobLearnMLPBackProp_Check_RET (*)PyBobLearnMLPBackProp_Check_PROTO) PyXbobLearnMLP_API[PyBobLearnMLPBackProp_Check_NUM])
# define PyBobLearnMLPBackProp_Check (*(PyBobLearnMLPBackProp_Check_RET (*)PyBobLearnMLPBackProp_Check_PROTO) PyBobLearnMLP_API[PyBobLearnMLPBackProp_Check_NUM])
# define PyBobLearnMLPRProp_Type (*(PyBobLearnMLPRProp_Type_TYPE *)PyXbobLearnMLP_API[PyBobLearnMLPRProp_Type_NUM])
# define PyBobLearnMLPRProp_Type (*(PyBobLearnMLPRProp_Type_TYPE *)PyBobLearnMLP_API[PyBobLearnMLPRProp_Type_NUM])
# define PyBobLearnMLPRProp_Check (*(PyBobLearnMLPRProp_Check_RET (*)PyBobLearnMLPRProp_Check_PROTO) PyXbobLearnMLP_API[PyBobLearnMLPRProp_Check_NUM])
# define PyBobLearnMLPRProp_Check (*(PyBobLearnMLPRProp_Check_RET (*)PyBobLearnMLPRProp_Check_PROTO) PyBobLearnMLP_API[PyBobLearnMLPRProp_Check_NUM])
# if !defined(NO_IMPORT_ARRAY)
......@@ -283,12 +283,12 @@ typedef struct {
* Returns -1 on error, 0 on success. PyCapsule_Import will set an exception
* if there's an error.
*/
static int import_xbob_learn_mlp(void) {
static int import_bob_learn_mlp(void) {
PyObject *c_api_object;
PyObject *module;
module = PyImport_ImportModule(BOOST_PP_STRINGIZE(XBOB_LEARN_MLP_MODULE_PREFIX) "." BOOST_PP_STRINGIZE(XBOB_LEARN_MLP_MODULE_NAME));
module = PyImport_ImportModule(BOOST_PP_STRINGIZE(BOB_LEARN_MLP_MODULE_PREFIX) "." BOOST_PP_STRINGIZE(BOB_LEARN_MLP_MODULE_NAME));
if (module == NULL) return -1;
......@@ -301,35 +301,35 @@ typedef struct {
# if PY_VERSION_HEX >= 0x02070000
if (PyCapsule_CheckExact(c_api_object)) {
PyXbobLearnMLP_API = (void **)PyCapsule_GetPointer(c_api_object,
PyBobLearnMLP_API = (void **)PyCapsule_GetPointer(c_api_object,
PyCapsule_GetName(c_api_object));
}
# else
if (PyCObject_Check(c_api_object)) {
XbobLearnMLP_API = (void **)PyCObject_AsVoidPtr(c_api_object);
BobLearnMLP_API = (void **)PyCObject_AsVoidPtr(c_api_object);
}
# endif
Py_DECREF(c_api_object);
Py_DECREF(module);
if (!XbobLearnMLP_API) {
if (!BobLearnMLP_API) {
PyErr_Format(PyExc_ImportError,
# if PY_VERSION_HEX >= 0x02070000
"cannot find C/C++ API capsule at `%s.%s._C_API'",
# else
"cannot find C/C++ API cobject at `%s.%s._C_API'",
# endif
BOOST_PP_STRINGIZE(XBOB_LEARN_MLP_MODULE_PREFIX),
BOOST_PP_STRINGIZE(XBOB_LEARN_MLP_MODULE_NAME));
BOOST_PP_STRINGIZE(BOB_LEARN_MLP_MODULE_PREFIX),
BOOST_PP_STRINGIZE(BOB_LEARN_MLP_MODULE_NAME));
return -1;
}
/* Checks that the imported version matches the compiled version */
int imported_version = *(int*)PyXbobLearnMLP_API[PyXbobLearnMLP_APIVersion_NUM];
int imported_version = *(int*)PyBobLearnMLP_API[PyBobLearnMLP_APIVersion_NUM];
if (XBOB_LEARN_MLP_API_VERSION != imported_version) {
PyErr_Format(PyExc_ImportError, "%s.%s import error: you compiled against API version 0x%04x, but are now importing an API with version 0x%04x which is not compatible - check your Python runtime environment for errors", BOOST_PP_STRINGIZE(XBOB_LEARN_MLP_MODULE_PREFIX), BOOST_PP_STRINGIZE(XBOB_LEARN_MLP_MODULE_NAME), XBOB_LEARN_MLP_API_VERSION, imported_version);
if (BOB_LEARN_MLP_API_VERSION != imported_version) {
PyErr_Format(PyExc_ImportError, "%s.%s import error: you compiled against API version 0x%04x, but are now importing an API with version 0x%04x which is not compatible - check your Python runtime environment for errors", BOOST_PP_STRINGIZE(BOB_LEARN_MLP_MODULE_PREFIX), BOOST_PP_STRINGIZE(BOB_LEARN_MLP_MODULE_NAME), BOB_LEARN_MLP_API_VERSION, imported_version);
return -1;
}
......@@ -340,6 +340,6 @@ typedef struct {
# endif //!defined(NO_IMPORT_ARRAY)
#endif /* XBOB_LEARN_MLP_MODULE */
#endif /* BOB_LEARN_MLP_MODULE */
#endif /* XBOB_LEARN_MLP_H */
#endif /* BOB_LEARN_MLP_H */
......@@ -2,13 +2,13 @@
* @author Andre Anjos <andre.anjos@idiap.ch>
* @date Thu 24 Apr 17:31:59 2014 CEST
*
* @brief General directives for all modules in xbob.learn.mlp
* @brief General directives for all modules in bob.learn.mlp
*/
#ifndef XBOB_LEARN_MLP_CONFIG_H
#define XBOB_LEARN_MLP_CONFIG_H
#ifndef BOB_LEARN_MLP_CONFIG_H
#define BOB_LEARN_MLP_CONFIG_H
/* Macros that define versions and important names */
#define XBOB_LEARN_MLP_API_VERSION 0x0200
#define BOB_LEARN_MLP_API_VERSION 0x0200
#endif /* XBOB_LEARN_MLP_CONFIG_H */
#endif /* BOB_LEARN_MLP_CONFIG_H */
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