提交 f75809eb authored 作者: Olivier Breuleux's avatar Olivier Breuleux

updated documentation to reflect Tensor -> NDArrayType

上级 3c5882e1
...@@ -86,8 +86,8 @@ This is what you would type to build the graph explicitly: ...@@ -86,8 +86,8 @@ This is what you would type to build the graph explicitly:
from theano.tensor import * from theano.tensor import *
# We instantiate a type that represents a matrix of doubles # We instantiate a type that represents a matrix of doubles
float64_matrix = Tensor(dtype = 'float64', # double float64_matrix = NDArrayType(dtype = 'float64', # double
broadcastable = (False, False)) # matrix broadcastable = (False, False)) # matrix
# We make the Result instances we need. # We make the Result instances we need.
x = Result(type = float64_matrix, name = 'x') x = Result(type = float64_matrix, name = 'x')
......
...@@ -221,11 +221,11 @@ attempt to clear up the confusion: ...@@ -221,11 +221,11 @@ attempt to clear up the confusion:
structural similarities. In the ``double`` example that we are structural similarities. In the ``double`` example that we are
doing, there is actually only one Type in that set, therefore the doing, there is actually only one Type in that set, therefore the
subclass doesn't represent anything that one of its instances subclass doesn't represent anything that one of its instances
doesn't. In this case it is a singleton. However, the Tensor class doesn't. In this case it is a singleton. However, the NDArrayType
which is a subclass of Type represents a set of types of tensors class which is a subclass of Type represents a set of types of
parametrized by their data type or number of dimensions. We could tensors parametrized by their data type or number of dimensions. We
say that subclassing Type builds a hierarchy of Types which is based could say that subclassing Type builds a hierarchy of Types which is
upon structural similarity rather than compatibility. based upon structural similarity rather than compatibility.
Final version Final version
......
...@@ -40,7 +40,7 @@ Theano provides some generic Op classes which allow you to generate a ...@@ -40,7 +40,7 @@ Theano provides some generic Op classes which allow you to generate a
lot of ops at a lesser effort. For instance, Elemwise can be used to lot of ops at a lesser effort. For instance, Elemwise can be used to
make :term:`elementwise` operations easily whereas DimShuffle can be make :term:`elementwise` operations easily whereas DimShuffle can be
used to make transpose-like transformations. These higher order Ops used to make transpose-like transformations. These higher order Ops
are mostly Tensor-related, as this is Theano's specialty. An exposé of are mostly NDArray-related, as this is Theano's specialty. An exposé of
them can therefore be found in :ref:`tensoroptools`. them can therefore be found in :ref:`tensoroptools`.
......
...@@ -49,16 +49,16 @@ is the type we assign to "0-dimensional arrays (`scalar`) of doubles ...@@ -49,16 +49,16 @@ is the type we assign to "0-dimensional arrays (`scalar`) of doubles
``dscalar`` is not a class. Therefore, neither ``x`` nor ``y`` ``dscalar`` is not a class. Therefore, neither ``x`` nor ``y``
are actually instances of ``dscalar``. They are instances of are actually instances of ``dscalar``. They are instances of
:api:`TensorResult <theano.tensor.basic.TensorResult>`. ``x`` and ``y`` :api:`NDArrayResult <theano.tensor.basic.NDArrayResult>`. ``x`` and ``y``
are, however, assigned the theano Type ``dscalar`` in their ``type`` are, however, assigned the theano Type ``dscalar`` in their ``type``
field, as you can see here: field, as you can see here:
>>> type(x) >>> type(x)
<class 'theano.tensor.basic.TensorResult'> <class 'theano.tensor.basic.NDArrayResult'>
>>> x.type >>> x.type
Tensor(float64, scalar) NDArrayType(float64, scalar)
>>> T.dscalar >>> T.dscalar
Tensor(float64, scalar) NDArrayType(float64, scalar)
>>> x.type == T.dscalar >>> x.type == T.dscalar
True True
......
...@@ -84,7 +84,7 @@ Custom tensor types ...@@ -84,7 +84,7 @@ Custom tensor types
If you wish to use a type of tensor which is not already available here If you wish to use a type of tensor which is not already available here
(for example, a 3D tensor) you can build an appropriate type using (for example, a 3D tensor) you can build an appropriate type using
``theano.tensor.Tensor``. The first argument you pass is the ``dtype`` ``theano.tensor.NDArrayType``. The first argument you pass is the ``dtype``
and the second is the ``broadcastable pattern``. and the second is the ``broadcastable pattern``.
Where ``dtype`` is one of: Where ``dtype`` is one of:
...@@ -110,7 +110,7 @@ complex128 complex 128 (two float64) ...@@ -110,7 +110,7 @@ complex128 complex 128 (two float64)
Even though ``theano.tensor`` does not define any type Even though ``theano.tensor`` does not define any type
using ``complex`` dtypes (``complex64`` or ``complex128``), using ``complex`` dtypes (``complex64`` or ``complex128``),
you can define them explicitly with ``Tensor`` (see example you can define them explicitly with ``NDArrayType`` (see example
below). However, few operations are fully supported for complex below). However, few operations are fully supported for complex
types: as of version 0.1, only elementary operations (``+-*/``) types: as of version 0.1, only elementary operations (``+-*/``)
have C implementations. Additionally, complex types have received have C implementations. Additionally, complex types have received
...@@ -154,11 +154,11 @@ bytes, we would do: ...@@ -154,11 +154,11 @@ bytes, we would do:
.. code-block:: python .. code-block:: python
# 3D tensor of signed bytes # 3D tensor of signed bytes
mytype = theano.tensor.Tensor('uint8', [False]*3) mytype = theano.tensor.NDArrayType('uint8', [False]*3)
# complex types (based on complex64) # complex types (based on complex64)
my_cscalar = theano.tensor.Tensor('complex64', []) my_cscalar = theano.tensor.NDArrayType('complex64', [])
my_cmatrix = theano.tensor.Tensor('complex64', [False, False]) my_cmatrix = theano.tensor.NDArrayType('complex64', [False, False])
Ops Ops
......
...@@ -6,7 +6,7 @@ How to make a new Op on tensors ...@@ -6,7 +6,7 @@ How to make a new Op on tensors
=============================== ===============================
This tutorial aims to explain how to create a new operation operating This tutorial aims to explain how to create a new operation operating
on numpy's ndarrays and using Theano's Tensor type. It is optional but on numpy's ndarrays and using Theano's NDArrayType. It is optional but
recommended to go through the :ref:`advtutorial` beforehand, which recommended to go through the :ref:`advtutorial` beforehand, which
explains more in detail the purpose of each of the methods you will explains more in detail the purpose of each of the methods you will
define here. define here.
......
.. _tensoroptools: .. _tensoroptools:
=============== ================
Tensor Op Tools NDArray Op Tools
=============== ================
WRITEME - describe how to use Elemwise here WRITEME - describe how to use Elemwise here
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论