提交 cdbc7df5 authored 作者: Joseph Turian's avatar Joseph Turian

Moving documentation from trac to sphinx

上级 78d43b5c
...@@ -8,7 +8,7 @@ README: theano ...@@ -8,7 +8,7 @@ README: theano
Project Description Project Description
=================== ===================
Theano is a python library for manipulating and evaluating expressions, especially matrix-valued ones. Theano is a python library and optimizing compiler for manipulating and evaluating expressions, especially matrix-valued ones.
What does Theano do that Python and numpy do not? What does Theano do that Python and numpy do not?
- *execution speed optimizations*: Theano can use `g++` to compile parts your expression graph into native machine code, which runs much faster than python. - *execution speed optimizations*: Theano can use `g++` to compile parts your expression graph into native machine code, which runs much faster than python.
...@@ -37,13 +37,17 @@ Here's a very simple example of how to use Theano. It doesn't show off many of ...@@ -37,13 +37,17 @@ Here's a very simple example of how to use Theano. It doesn't show off many of
Theano is not a programming language in the normal sense because you write a program in Python that builds expressions for Theano. Still it is like a programming language in the sense that to use theano, you have to Theano is not a programming language in the normal sense because you write a program in Python that builds expressions for Theano. Still it is like a programming language in the sense that to use theano, you have to
- declare variables ({{{a,b}}}) and give their types - declare variables (``a,b``) and give their types
- build expressions for how to put those variables together - build expressions for how to put those variables together
- compile expression graphs to functions in order to use them for computation. - compile expression graphs to functions in order to use them for computation.
It is good to think of `theano.function` as the interface to a compiler which builds a callable object from a purely symbolic graph. It is good to think of ``theano.function`` as the interface to a compiler
which builds a callable object from a purely symbolic graph; one of
theano's most important features is that ``theano.function`` can
optimize a graph, and even compile some or all of it into native machine
instructions if you pass ``linker='c'`` as a keyword argument.
License License
...@@ -55,9 +59,6 @@ Theano is licensed under a BSD-like license. See the LICENSE file in the projec ...@@ -55,9 +59,6 @@ Theano is licensed under a BSD-like license. See the LICENSE file in the projec
Installation Installation
============ ============
(See also the :wiki:`InstallationNotes` on the wiki.)
Software Requirements Software Requirements
--------------------- ---------------------
...@@ -94,15 +95,24 @@ Get the source and run the tests like this: ...@@ -94,15 +95,24 @@ Get the source and run the tests like this:
cd Theano cd Theano
nosetests #execute all the tests nosetests #execute all the tests
All tests should pass. From time to time, their is some test that are know to fail, but normally we know them and are trying to fix them. But to be sure contact us about them. All tests should pass. From time to time, there is some test that are
know to fail, but normally we know them and are trying to fix them. But
to be sure contact us about them.
To define PYTHONPATH if it don't exist: The environment variables PYTHONPATH should be modified to allow python
import. In bash do this:
.. code-block:: bash .. code-block:: bash
export PYTHONPATH=<path to theano>:$PYTHONPATH
export PYTHONPATH=<path to theano>:$PYTHONPATH
In csh:
.. code-block:: csh
setevn PYTHONPATH <path to theano>:$PYTHONPATH
To update your library to the latest on pylearn.org, change directory (`cd`) to this `theano` folder and type To update your library to the latest on pylearn.org, change directory (`cd`) to this `Theano` folder and type
.. code-block:: bash .. code-block:: bash
...@@ -112,7 +122,7 @@ To update your library to the latest on pylearn.org, change directory (`cd`) to ...@@ -112,7 +122,7 @@ To update your library to the latest on pylearn.org, change directory (`cd`) to
`<http://pylearn.org/hg/theano/archive/tip.tar.gz>`__. `<http://pylearn.org/hg/theano/archive/tip.tar.gz>`__.
Configuring the environment Configuring the environment
------------------ ---------------------------
Two environment variables are used to control automatic code generation. Two environment variables are used to control automatic code generation.
(It is possible to use theano in a way that avoids all automatic code generation, but the functions you make using {{{theano.function}}} will execute more slowly.) (It is possible to use theano in a way that avoids all automatic code generation, but the functions you make using {{{theano.function}}} will execute more slowly.)
...@@ -184,6 +194,14 @@ Use something like the following in your .bashrc: ...@@ -184,6 +194,14 @@ Use something like the following in your .bashrc:
# Theano is not process-safe or thread-safe in this sense. # Theano is not process-safe or thread-safe in this sense.
THEANO_COMPILEDIR=/ltmp/<username>_theano THEANO_COMPILEDIR=/ltmp/<username>_theano
You may also need to run the following from your shell:
.. code-block:: bash
module add python # for the current shell session
module initadd python # for this and future sessions
Lastly, if ``./filename.py`` doesn't work, try ``python filename.py``.
Running the Test Suite Running the Test Suite
====================== ======================
......
...@@ -44,14 +44,16 @@ In the following example, we will build a function `f(x) = x + 1.5`. We will the ...@@ -44,14 +44,16 @@ In the following example, we will build a function `f(x) = x + 1.5`. We will the
f = theano.function([x], [y]) f = theano.function([x], [y])
# We now bind 2.5 to an internal copy of x and evaluate an internal y, # We now bind 2.5 to an internal copy of x and evaluate an internal y,
# which we return. # which we return (actually f(2.5) returns a list because theano
# We assert that 4.0 == f(2.5) = 2.5 + 1.5 # functions in general can return many things).
assert 4.0 == f(2.5) # We assert that 4.0 == f(2.5)[0] = 2.5 + 1.5
assert 4.0 == f(2.5)[0]
In the example above, `c`, `x`, and `y` are each a ''symbolic'' result_. They In the example above, `c`, `x`, and `y` are each a ''symbolic''
are symbolic because they stand for variables and have a type_, but result_. They are symbolic because they stand for variables and have
do not necessarily store actual values. Not yet, at least. (To give them a type_, but do not actually store instantiated variables. Not yet,
values, we will have to `evaluate` them. More on this below.) at least. (To give them values, we will have to `evaluate` them.
More on this below.)
.. _result: glossary.html#result .. _result: glossary.html#result
.. _type: glossary.html#type .. _type: glossary.html#type
...@@ -60,14 +62,15 @@ Since we are using the addition operator (`x + c`) here on symbolic results, the ...@@ -60,14 +62,15 @@ Since we are using the addition operator (`x + c`) here on symbolic results, the
output `y` is also symbolic. The `+` corresponds to an ''operation'' in theano output `y` is also symbolic. The `+` corresponds to an ''operation'' in theano
terminology, or ''op'' for short. terminology, or ''op'' for short.
We use these results and ops to construct a `symbolic graph`_. The graph is We use these results and ops to construct a `symbolic graph`_. The graph
symbolic because we declare what it computes, but do not actually perform any is symbolic because we declare what it computes, but do not actually
computation. Some type-checking is done on while we build our graphs, so if you perform any computation. Some type-checking is done on while we build
try to do something really crazy you'll see an exception right away. our graphs, so if you try to do something really crazy you'll see an
exception right away.
.. _symbolic graph: glossary.html#symbolicgraph .. _symbolic graph: glossary.html#symbolicgraph
To actually use our graph for computation, we have to compile (or build) it into To actually use our graph for computation, we have to compile_ (or build_) it into
a function `f`. The compiled function is actually capable of performing a function `f`. The compiled function is actually capable of performing
computation. So after we have built f, we use it to compute the value of y from computation. So after we have built f, we use it to compute the value of y from
a `value input` x. Some argument checking is only possible at run-time, so if a `value input` x. Some argument checking is only possible at run-time, so if
......
...@@ -13,10 +13,11 @@ Theano ...@@ -13,10 +13,11 @@ Theano
A python library for manipulating and evaluating matrix expressions A python library for manipulating and evaluating matrix expressions
------------------------------------------------------------------- -------------------------------------------------------------------
Theano is a library in Python, built to evaluate complicated Theano is a library and optimizing compiler in Python, built to
expressions (especially matrix-valued ones) as quickly as possible. evaluate complicated expressions (especially matrix-valued ones) as
It was written at LISA_ to explore techniques for machine learning. quickly as possible. It was written at LISA_ to explore techniques
Our project uses the name to honour the ancient Greek mathematician. for machine learning. Our project uses the name to honour the ancient
Greek mathematician.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论