Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.learn.activation
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
Model registry
Operate
Environments
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.activation
Commits
4aacfe1f
Commit
4aacfe1f
authored
11 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
Fix C-API
parent
1a120afd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/c_cpp_api.rst
+17
-16
17 additions, 16 deletions
doc/c_cpp_api.rst
xbob/learn/activation/include/xbob.learn.activation/api.h
+1
-1
1 addition, 1 deletion
xbob/learn/activation/include/xbob.learn.activation/api.h
with
18 additions
and
17 deletions
doc/c_cpp_api.rst
+
17
−
16
View file @
4aacfe1f
...
...
@@ -6,11 +6,12 @@
C++ API
=========
The C++ API of ``xbob.machine`` allows users to leverage from automatic
converters for classes in :py:class:`xbob.machine`. To use the C API, clients
should first, include the header file ``<xbob.machine/api.h>`` on their
compilation units and then, make sure to call once ``import_xbob_machine()`` at
their module instantiation, as explained at the `Python manual
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
...
...
@@ -18,7 +19,7 @@ the import function:
.. code-block:: c++
#include <xbob.
machine
/api.h>
#include <xbob.
learn.activation
/api.h>
PyMODINIT_FUNC initclient(void) {
...
...
@@ -35,20 +36,20 @@ the import function:
// imports xbob.io C-API
import_xbob_io();
// imports xbob.
machine
C-API
import_xbob_
machine
();
// imports xbob.
learn.activation
C-API
import_xbob_
learn_activation
();
}
.. note::
The include directory can be discovered using
:py:func:`xbob.
machine
.get_include`.
:py:func:`xbob.
learn.activation
.get_include`.
Activation Functors
-------------------
.. cpp:type:: PyBob
Machine
ActivationObject
.. cpp:type:: PyBob
Learn
ActivationObject
The pythonic object representation for a ``bob::machine::Activation``
object. It is the base class of all activation functors available in
...
...
@@ -60,16 +61,16 @@ Activation Functors
typedef struct {
PyObject_HEAD
bob::machine::Activation* base;
} PyBob
Machine
ActivationObject;
} PyBob
Learn
ActivationObject;
.. cpp:member:: bob::machine::Activation* base
A pointer to the activation functor virtual implementation.
.. cpp:function:: int PyBob
Machine
Activation_Check(PyObject* o)
.. cpp:function:: int PyBob
Learn
Activation_Check(PyObject* o)
Checks if the input object ``o`` is a ``PyBob
Machine
ActivationObject``.
Checks if the input object ``o`` is a ``PyBob
Learn
ActivationObject``.
Returns ``1`` if it is, and ``0`` otherwise.
...
...
@@ -84,9 +85,9 @@ Activation Functors
.. code-block:: c++
typedef struct {
PyBob
Machine
ActivationObject parent;
PyBob
Learn
ActivationObject parent;
bob::machine::<Subtype>Activation* base;
} PyBob
Machine
<Subtype>ActivationObject;
} PyBob
Learn
<Subtype>ActivationObject;
Presently, ``<Subtype>`` can be one of:
...
...
@@ -97,6 +98,6 @@ Activation Functors
* MultipliedHyperbolicTangent
Type objects are also named consistently like
``PyBob
Machine
<Subtype>_Type``.
``PyBob
Learn
<Subtype>
Activation
_Type``.
.. include:: links.rst
This diff is collapsed.
Click to expand it.
xbob/learn/activation/include/xbob.learn.activation/api.h
+
1
−
1
View file @
4aacfe1f
...
...
@@ -230,7 +230,7 @@ typedef struct {
* Returns -1 on error, 0 on success. PyCapsule_Import will set an exception
* if there's an error.
*/
static
int
import_xbob_io
(
void
)
{
static
int
import_xbob_
learn_activat
io
n
(
void
)
{
PyObject
*
c_api_object
;
PyObject
*
module
;
...
...
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