Skip to content

Commit

Permalink
Document TensorTypes and their equivalent C types
Browse files Browse the repository at this point in the history
  • Loading branch information
carriepl committed Oct 23, 2014
1 parent 2173ff1 commit 46b27fd
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
36 changes: 36 additions & 0 deletions doc/extending/other_ops.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,39 @@ Numba Ops
Want C speed without writing C code for your new Op? You can use Numba
to generate the C code for you! Here is an `example
Op <https://gist.github.com/nouiz/5492778#file-theano_op-py>`_ doing that.

Alternate Theano Types
======================

Most ops in Theano are used to manipulate tensors. However, Theano also
supports many other variable types. These are listed below, along with
pointers to the relevant documentation.

* TypedList : Theano type that represents a typed list (a list where
every element in the list has the same Theano type). Variables of this
Theano type are represented in C as objects of class
`PyListObject <https://docs.python.org/2/c-api/list.html>`_. The
documentation for TypedList can be found
:ref:`here <libdoc_typed_list>`.

* Generic : Theano type that represents a simple Python Object.
Variables of this Theano type are represented in C as objects of class
`PyObject
<https://docs.python.org/2/c-api/structures.html#c.PyObject>`_. The
documentation for TypedList can be found
:class:`here <theano.gof.type.Generic>`.

* Scalar : Theano type that represents a C primitive type. The C type
associated with this Theano type is the represented C primitive
itself. The documentation for the Scalar type can be
found :ref:`here <libdoc_scalar>`.

* CDataType : Theano type that represents a C data type. The C type
associated with this Theano type depends on the data being
represented.The documentation for CDataType can be found
:class:`here <theano.gof.type.CDataType>`.

* SparseType : Theano type used to represent sparse tensors. There is no
equivalent C type for this Theano Type but Theano provides functions
to extract the data from SparseType variables. The documentation for
Ops that rely on SparseType can be found :ref:`here <sparse_ops>`.
7 changes: 7 additions & 0 deletions doc/tutorial/extending_theano_c.txt
Original file line number Diff line number Diff line change
Expand Up @@ -953,3 +953,10 @@ apply-specific because it uses the macros defined by ``COp``. Finally, the
function ``vector_times_vector()`` is apply-specific because it uses those
same macros and also because it calls ``vector_elemwise_mult()`` which is an
apply-specific function.

Final Note
==========

This tutorial focuses on providing C implementations to ops that manipulate
Theano tensors. For more information about other Theano types, you can refer
to the section :ref:`Other ops <other_ops>`.

0 comments on commit 46b27fd

Please sign in to comment.