Skip to content
Snippets Groups Projects
c_cpp_api.rst 6.54 KiB

C++ API

The C++ API of bob.learn.mlp allows users to leverage from automatic converters for classes in :py:class:`bob.learn.mlp`. To use the C API, clients should first, include the header file <bob.learn.mlp.h> on their compilation units and then, make sure to call once import_bob_learn_mlp() at their module instantiation, as explained at the Python manual.

Here is a dummy C example showing how to include the header and where to call the import function:

#include <bob.learn.mlp/api.h>

PyMODINIT_FUNC initclient(void) {

  PyObject* m Py_InitModule("client", ClientMethods);

  if (!m) return 0;

  if (import_bob_blitz() < 0) return 0;
  if (import_bob_io() < 0) return 0;
  if (import_bob_learn_activation() < 0) return 0;
  if (import_bob_learn_mlp() < 0) return 0;

  return m;

}

Note

The include directory can be discovered using :py:func:`bob.learn.mlp.get_include`.

Machine

Cost

Note

These are the cost object specializations you can use from Python:

  • :py:class:`bob.learn.mlp.SquareError`
  • :py:class:`bob.learn.mlp.CrossEntropyLoss`

For each of those types, object types in C exist.

Data Shuffler

Trainers

Pure C/C++ API

As explained above, each PyObject produced by this library contains a pointer to a pure C++ implementation of a similar object. The C++ of such objects is described in this section.