Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.learn.em
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.learn.em
Commits
74ac2228
Commit
74ac2228
authored
11 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
Fix documentation tests
parent
48912199
No related branches found
No related tags found
No related merge requests found
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
doc/c_cpp_api.rst
+0
-121
0 additions, 121 deletions
doc/c_cpp_api.rst
doc/conf.py
+6
-6
6 additions, 6 deletions
doc/conf.py
doc/guide.rst
+777
-0
777 additions, 0 deletions
doc/guide.rst
doc/index.rst
+7
-8
7 additions, 8 deletions
doc/index.rst
doc/py_api.rst
+2
-2
2 additions, 2 deletions
doc/py_api.rst
with
792 additions
and
137 deletions
doc/c_cpp_api.rst
deleted
100644 → 0
+
0
−
121
View file @
48912199
.. vim: set fileencoding=utf-8 :
.. Andre Anjos <andre.dos.anjos@gmail.com>
.. Tue 15 Oct 14:59:05 2013
=========
C++ API
=========
The C++ API of ``xbob.learn.activation`` allows users to leverage from
automatic converters for classes in :py:class:`xbob.learn.activation`. To use
the C API, clients should first, include the header file
``<xbob.learn.activation/api.h>`` on their compilation units and then, make
sure to call once ``import_xbob_learn_activation()`` at their module
instantiation, as explained at the `Python manual
<http://docs.python.org/2/extending/extending.html#using-capsules>`_.
Here is a dummy C example showing how to include the header and where to call
the import function:
.. code-block:: c++
#include <xbob.learn.activation/api.h>
PyMODINIT_FUNC initclient(void) {
PyObject* m Py_InitModule("client", ClientMethods);
if (!m) return;
// imports dependencies
if (import_xbob_blitz() < 0) {
PyErr_Print();
PyErr_SetString(PyExc_ImportError, "cannot import module");
return 0;
}
if (import_xbob_io_base() < 0) {
PyErr_Print();
PyErr_SetString(PyExc_ImportError, "cannot import module");
return 0;
}
if (import_xbob_learn_activation() < 0) {
PyErr_Print();
PyErr_SetString(PyExc_ImportError, "cannot import module");
return 0;
}
// imports xbob.learn.activation C-API
import_xbob_learn_activation();
}
.. note::
The include directory can be discovered using
:py:func:`xbob.learn.activation.get_include`.
Activation Functors
-------------------
.. cpp:type:: PyBobLearnActivationObject
The pythonic object representation for a ``bob::machine::Activation``
object. It is the base class of all activation functors available in
|project|. In C/C++ code, we recommend you only manipulate objects like this
to keep your code agnostic to the activation type being used.
.. code-block:: cpp
typedef struct {
PyObject_HEAD
bob::machine::Activation* base;
} PyBobLearnActivationObject;
.. cpp:member:: bob::machine::Activation* base
A pointer to the activation functor virtual implementation.
.. cpp:function:: int PyBobLearnActivation_Check(PyObject* o)
Checks if the input object ``o`` is a ``PyBobLearnActivationObject``.
Returns ``1`` if it is, and ``0`` otherwise.
.. cpp:function:: PyObject* PyBobLearnActivation_NewFromActivation(boost::shared_ptr<bob::machine::Activation> a)
Constructs a new :c:type:`PyBobLearnActivationObject` starting from a shared
pointer to a pre-allocated `bob::machine::Activation` instance. This API is
available so that return values from actuall C++ machines can be mapped into
Python. It is the sole way to build an object of type :py:class:`Activation`
without recurring to the derived classes.
.. note::
Other object definitions exist for each of the specializations for
activation functors found in |project|. They are exported through the module
C-API, but we don't recommend using them since you'd loose generality. In
case you do absolutely need to use any of these derivations, they have all
the same object configuration:
.. code-block:: c++
typedef struct {
PyBobLearnActivationObject parent;
bob::machine::<Subtype>Activation* base;
} PyBobLearn<Subtype>ActivationObject;
Presently, ``<Subtype>`` can be one of:
* Identity
* Linear
* Logistic
* HyperbolicTangent
* MultipliedHyperbolicTangent
Type objects are also named consistently like
``PyBobLearn<Subtype>Activation_Type``.
.. include:: links.rst
This diff is collapsed.
Click to expand it.
doc/conf.py
+
6
−
6
View file @
74ac2228
...
...
@@ -58,12 +58,12 @@ source_suffix = '.rst'
master_doc
=
'
index
'
# General information about the project.
project
=
u
'
xbob.learn.
activation
'
project
=
u
'
xbob.learn.
misc
'
import
time
copyright
=
u
'
%s, Idiap Research Institute
'
%
time
.
strftime
(
'
%Y
'
)
# Grab the setup entry
distribution
=
pkg_resources
.
require
(
'
xbob.learn.
activation
'
)[
0
]
distribution
=
pkg_resources
.
require
(
'
xbob.learn.
misc
'
)[
0
]
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
...
...
@@ -129,7 +129,7 @@ if sphinx.__version__ >= "1.0":
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = 'xbob_learn_
activation
'
#html_short_title = 'xbob_learn_
misc
'
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
...
...
@@ -187,7 +187,7 @@ html_favicon = 'img/favicon.ico'
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename
=
'
xbob_learn_
activation
_doc
'
htmlhelp_basename
=
'
xbob_learn_
misc
_doc
'
# -- Options for LaTeX output --------------------------------------------------
...
...
@@ -201,7 +201,7 @@ latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents
=
[
(
'
index
'
,
'
xbob_learn_
activation
.tex
'
,
u
'
Bob
Activation Function
s
'
,
(
'
index
'
,
'
xbob_learn_
misc
.tex
'
,
u
'
Bob
Miscellaneous Machine Learning Tool
s
'
,
u
'
Biometrics Group, Idiap Research Institute
'
,
'
manual
'
),
]
...
...
@@ -241,7 +241,7 @@ rst_epilog = """
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages
=
[
(
'
index
'
,
'
xbob_learn_
activation
'
,
u
'
Bob Activation Function Documentation
'
,
[
u
'
Idiap Research Institute
'
],
1
)
(
'
index
'
,
'
xbob_learn_
misc
'
,
u
'
Bob Miscellaneous Machine Learning Tools
'
,
[
u
'
Idiap Research Institute
'
],
1
)
]
# Default processing flags for sphinx
...
...
This diff is collapsed.
Click to expand it.
doc/guide.rst
0 → 100644
+
777
−
0
View file @
74ac2228
This diff is collapsed.
Click to expand it.
doc/index.rst
+
7
−
8
View file @
74ac2228
...
...
@@ -2,17 +2,16 @@
.. Andre Anjos <andre.anjos@idiap.ch>
.. Fri 13 Dec 2013 12:50:06 CET
..
.. Copyright (C) 2011-201
3
Idiap Research Institute, Martigny, Switzerland
.. Copyright (C) 2011-201
4
Idiap Research Institute, Martigny, Switzerland
=========================
Bob Activation Functor
s
=========================
=========================
=============
Miscellaneous Machine Learning Tool
s
=========================
=============
.. todolist::
This module contains some functionality from Bob bound to Python, available in
the C++ counter-part ``bob::machine``. It includes Activation functors from the
Machine Learning core.
This package includes various machine learning utitilities which have not yet
been ported into the new framework.
Documentation
-------------
...
...
@@ -20,8 +19,8 @@ Documentation
.. toctree::
:maxdepth: 2
guide
py_api
c_cpp_api
Indices and tables
------------------
...
...
This diff is collapsed.
Click to expand it.
doc/py_api.rst
+
2
−
2
View file @
74ac2228
...
...
@@ -7,8 +7,8 @@
============
This section includes information for using the pure Python API of
``xbob.learn.
activation
``.
``xbob.learn.
misc
``.
.. automodule:: xbob.learn.
activation
.. automodule:: xbob.learn.
misc
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment