This tutorial covers how to extend Theano. It mainly focuses on Ops that offer a Python implementation, refers to :ref:`extending_theano_c` for C-based Op.
=============
- Theano works with symbolic graphs.
Providing a novel Theano Op requires an understanting of the Theano Graphs,
- Those graphs are bi-partite graphs (graphs with 2 types of nodes).
which is introduced in the next section of this tutorial. This tutorial then propose an overview of the most important methods that the Op needs to implement.Finally, it shows how to combine these elements to write a simple Python-based Op that performs operation on Double. It also shows how to tests for ensuring the proper working of an Op.
- The two types of nodes are ``Apply`` and ``Variable`` nodes.
- Each ``Apply`` node has a link to the op that it executes.
Theano represents symbolic mathematical computations as graphs. Those graphs are bi-partite graphs (graphs with 2 types of nodes), they are composed of interconnected :ref:`apply` and :ref:`variable` nodes which associated to *function application* and *data*, respectively. Inputs and Outputs of a graph are lists of Theano :ref:`variable`. Each :ref:`apply` node, corresponding to a *function application*, has a link to the operation that it which is represented by :ref:`Op` instance. This tutorial details how to write such Op instance. Please refers to :ref:`graphstructures` for a more detailed explanation about the graph structure.
Op Structure
Op Structure
============
============
This an overview of the methods you typically have to implement to
An Op is any Python object which inherits from :class:`gof.Op`.
make a new op. It does not provide extensive coverage of all the
possibilities you may encounter or need. For that refer to
:ref:`op_contract`.
.. code-block:: python
.. code-block:: python
...
@@ -64,11 +65,11 @@ possibilities you may encounter or need. For that refer to
...
@@ -64,11 +65,11 @@ possibilities you may encounter or need. For that refer to