提交 7344f170 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

merge

...@@ -68,12 +68,12 @@ This is what you would normally type: ...@@ -68,12 +68,12 @@ This is what you would normally type:
.. code-block:: python .. code-block:: python
from theano.tensor import * from theano.tensor import *
# create 3 Variables with owner = None # create 3 Variables with owner = None
x = matrix('x') x = matrix('x')
y = matrix('y') y = matrix('y')
z = matrix('z') z = matrix('z')
# create 2 Variables (one for 'e', one intermediate for y*z) # create 2 Variables (one for 'e', one intermediate for y*z)
# create 2 Apply instances (one for '+', one for '*') # create 2 Apply instances (one for '+', one for '*')
e = x + y * z e = x + y * z
...@@ -86,7 +86,7 @@ This is what you would type to build the graph explicitly: ...@@ -86,7 +86,7 @@ This is what you would type to build the graph explicitly:
.. code-block:: python .. code-block:: python
from theano.tensor import * from theano.tensor import *
# Instantiate a type that represents a matrix of doubles # Instantiate a type that represents a matrix of doubles
float64_matrix = TensorType(dtype = 'float64', # double float64_matrix = TensorType(dtype = 'float64', # double
broadcastable = (False, False)) # matrix broadcastable = (False, False)) # matrix
...@@ -129,7 +129,7 @@ Note how the call to ``Apply`` modifies the ``owner`` and ``index`` ...@@ -129,7 +129,7 @@ Note how the call to ``Apply`` modifies the ``owner`` and ``index``
fields of the :ref:`Variables <variable>` passed as outputs to point to fields of the :ref:`Variables <variable>` passed as outputs to point to
itself and the rank they occupy in the output list. This whole itself and the rank they occupy in the output list. This whole
machinery builds a DAG (Directed Acyclic Graph) representing the machinery builds a DAG (Directed Acyclic Graph) representing the
computation, a graph that theano can compile and optimize. computation, a graph that Theano can compile and optimize.
Automatic wrapping Automatic wrapping
...@@ -189,8 +189,8 @@ inputs. Therefore, an Apply node may be obtained from an Op ...@@ -189,8 +189,8 @@ inputs. Therefore, an Apply node may be obtained from an Op
and a list of inputs by calling ``Op.make_node(*inputs)``. and a list of inputs by calling ``Op.make_node(*inputs)``.
Comparing with the Python language, an :ref:`apply` node is Comparing with the Python language, an :ref:`apply` node is
theano's version of a function call whereas an :ref:`op` is Theano's version of a function call whereas an :ref:`op` is
theano's version of a function definition. Theano's version of a function definition.
An Apply instance has three important fields: An Apply instance has three important fields:
......
...@@ -94,7 +94,7 @@ operation on ``x``. ...@@ -94,7 +94,7 @@ operation on ``x``.
.. note:: .. note::
Inplace operations in theano still work in a functional setting: Inplace operations in Theano still work in a functional setting:
they need to return the modified input. Symbolically, Theano they need to return the modified input. Symbolically, Theano
requires one Variable standing for the input *before* being modified requires one Variable standing for the input *before* being modified
and *another* Variable representing the input *after* being and *another* Variable representing the input *after* being
......
...@@ -160,7 +160,7 @@ the Type is to instantiate a plain Type and set the needed fields: ...@@ -160,7 +160,7 @@ the Type is to instantiate a plain Type and set the needed fields:
.. code-block:: python .. code-block:: python
from theano import gof from Theano import gof
double = gof.Type() double = gof.Type()
double.filter = filter double.filter = filter
...@@ -216,7 +216,7 @@ There are several ways to make sure that equality testing works properly: ...@@ -216,7 +216,7 @@ There are several ways to make sure that equality testing works properly:
#. Hide the Double class and only advertise a single instance of it. #. Hide the Double class and only advertise a single instance of it.
Here we will prefer the final option, because it's the simplest. Here we will prefer the final option, because it's the simplest.
Often Ops in the theano code define the ``__eq__`` function though. Often Ops in the Theano code define the ``__eq__`` function though.
Untangling some concepts Untangling some concepts
......
...@@ -179,7 +179,7 @@ Extending your Module with Python methods ...@@ -179,7 +179,7 @@ Extending your Module with Python methods
Let's say we want to add a method to our accumulator to print out the Let's say we want to add a method to our accumulator to print out the
state and we want to call it ``print_state``. There are two mechanisms to do state and we want to call it ``print_state``. There are two mechanisms to do
this: let's call them instance methods and InstanceType. this: let's call them _instance_method and InstanceType.
Mechanism 1: _instance_method Mechanism 1: _instance_method
...@@ -198,7 +198,7 @@ Note that when we define ``_instance_print_state`` there are two "self" ...@@ -198,7 +198,7 @@ Note that when we define ``_instance_print_state`` there are two "self"
arguments: ``self`` which is *symbolic* and ``obj`` which is the compiled arguments: ``self`` which is *symbolic* and ``obj`` which is the compiled
object (the one that contains values). object (the one that contains values).
Hint:``self.state`` is the symbolic state variable and Hint: ``self.state`` is the symbolic state variable and
prints out as "state", whereas ``obj.state`` is the state's actual prints out as "state", whereas ``obj.state`` is the state's actual
value in the accumulator and prints out as "0.0". value in the accumulator and prints out as "0.0".
...@@ -207,7 +207,7 @@ Mechanism 2: InstanceType ...@@ -207,7 +207,7 @@ Mechanism 2: InstanceType
------------------------- -------------------------
If a number of instance methods are going to be defined, and especially if you If a number of instance methods are going to be defined, and especially if you
will want to inherit from the kind of class that gets instantiated by make, will want to inherit from the kind of class that gets instantiated by ``make``,
you might prefer to consider using the InstanceType mechanism. you might prefer to consider using the InstanceType mechanism.
...@@ -223,15 +223,16 @@ where we give the states' initial values with keyword arguments ...@@ -223,15 +223,16 @@ where we give the states' initial values with keyword arguments
can override the default with your own method, which has to be called can override the default with your own method, which has to be called
``_instance_initialize``. ``_instance_initialize``.
Here is an example where we take width and height arguments to .. TODO
initialize a state with a matrix of zeros: Here is an example where we take width and height arguments to
initialize a state with a matrix of zeros:
Nesting Modules Nesting Modules
=============== ===============
Probably the most powerful feature of theano's modules is that one can be Probably the most powerful feature of Theano's Modules is that one can be
included as an attribute to another so that the storage of each is available included as an attribute to another so that the storage of each is available
to both. to both.
......
...@@ -8,14 +8,14 @@ Basic Tutorial Mini-Reference ...@@ -8,14 +8,14 @@ Basic Tutorial Mini-Reference
Mode Mode
==== ====
============= =========================================================== =============================================================================== ================= =============================================================== ===============================================================================
short name Full constructor What does it do? short name Full constructor What does it do?
============= =========================================================== =============================================================================== ================= =============================================================== ===============================================================================
(default) compile.mode.Mode(linker='py', optimizer=None) Python implementations with zero graph modifications. (default) ``compile.mode.Mode(linker='py', optimizer=None)`` Python implementations with zero graph modifications.
FAST_COMPILE compile.mode.Mode(linker='c|py', optimizer='fast_compile') C implementations where available, quick and cheap graph transformations FAST_COMPILE ``compile.mode.Mode(linker='c|py', optimizer='fast_compile')`` C implementations where available, quick and cheap graph transformations
FAST_RUN compile.mode.Mode(linker='c|py', optimizer='fast_run') C implementations where available, all available graph transformations. FAST_RUN ``compile.mode.Mode(linker='c|py', optimizer='fast_run')`` C implementations where available, all available graph transformations.
DEBUG_MODE compile.debugmode.DebugMode() Both implementations where available, all available graph transformations. DEBUG_MODE ``compile.debugmode.DebugMode()`` Both implementations where available, all available graph transformations.
============= =========================================================== =============================================================================== ================= =============================================================== ===============================================================================
.. _tensortypes: .. _tensortypes:
......
...@@ -9,7 +9,7 @@ class AccumulatorInstance(ModuleInstance): ...@@ -9,7 +9,7 @@ class AccumulatorInstance(ModuleInstance):
class Accumulator(Module): class Accumulator(Module):
# This line tells theano to instantiate an AccumulatorInstance # This line tells Theano to instantiate an AccumulatorInstance
# when make() is called. # when make() is called.
InstanceType = AccumulatorInstance InstanceType = AccumulatorInstance
......
...@@ -91,10 +91,10 @@ Glossary of terminology ...@@ -91,10 +91,10 @@ Glossary of terminology
WRITEME WRITEME
type type
See :ref:`tensortypes` See :ref:`tensortypes` or :ref:`type`.
Variable Variable
A :ref:`variable` is the main data structure you work with when A :ref:`Variable` is the main data structure you work with when
using Theano. The symbolic inputs that you operate on are using Theano. The symbolic inputs that you operate on are
Variables and what you get from applying various operations to Variables and what you get from applying various operations to
these inputs are also Variables. For example, when I type these inputs are also Variables. For example, when I type
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论