提交 e45ce1c4 authored 作者: David Warde-Farley's avatar David Warde-Farley

Spurious whitespace.

上级 3cfd3f3f
...@@ -46,7 +46,7 @@ Reference ...@@ -46,7 +46,7 @@ Reference
.. method:: __init__(variable, borrow=False) .. method:: __init__(variable, borrow=False)
Initialize attributes from arguments. Initialize attributes from arguments.
.. class:: Param .. class:: Param
...@@ -57,21 +57,21 @@ Reference ...@@ -57,21 +57,21 @@ Reference
A variable in an expression graph to use as a compiled-function parameter A variable in an expression graph to use as a compiled-function parameter
.. attribute:: default .. attribute:: default
The default value to use at call-time (can also be a Container where The default value to use at call-time (can also be a Container where
the function will find a value at call-time.) the function will find a value at call-time.)
.. attribute:: name .. attribute:: name
A string to identify an argument for this parameter in keyword arguments. A string to identify an argument for this parameter in keyword arguments.
.. attribute:: mutable .. attribute:: mutable
``True`` means the compiled-function is allowed to modify this ``True`` means the compiled-function is allowed to modify this
argument. ``False`` means it is not allowed. argument. ``False`` means it is not allowed.
.. attribute:: strict .. attribute:: strict
If ``False``, a function argument may be copied or cast to match the type If ``False``, a function argument may be copied or cast to match the type
required by the parameter `variable`. If ``True``, a function argument required by the parameter `variable`. If ``True``, a function argument
must exactly match the type required by `variable`. must exactly match the type required by `variable`.
......
...@@ -11,7 +11,7 @@ symbolic matrix expressions. When you type, ...@@ -11,7 +11,7 @@ symbolic matrix expressions. When you type,
>>> x = T.fmatrix() >>> x = T.fmatrix()
the ``x`` is a :class:`TensorVariable` instance. the ``x`` is a :class:`TensorVariable` instance.
The ``T.fmatrix`` object itself is an instance of :class:`TensorType`. The ``T.fmatrix`` object itself is an instance of :class:`TensorType`.
Theano knows what type of variable ``x`` is because ``x.type`` Theano knows what type of variable ``x`` is because ``x.type``
points back to ``T.fmatrix``. points back to ``T.fmatrix``.
...@@ -98,71 +98,71 @@ They are all callable, and accept an optional ``name`` argument. So for example ...@@ -98,71 +98,71 @@ They are all callable, and accept an optional ``name`` argument. So for example
xyz = dmatrix('xyz') # creates one Variable with name 'xyz' xyz = dmatrix('xyz') # creates one Variable with name 'xyz'
.. #COMMENT .. #COMMENT
table generated by table generated by
$ python Theano/doc/generate_dtype_tensor_table.py $ python Theano/doc/generate_dtype_tensor_table.py
============ =========== ==== =========== ================================= ============ =========== ==== =========== =================================
Constructor dtype ndim shape broadcastable Constructor dtype ndim shape broadcastable
============ =========== ==== =========== ================================= ============ =========== ==== =========== =================================
bscalar int8 0 () () bscalar int8 0 () ()
bvector int8 1 (?,) (False,) bvector int8 1 (?,) (False,)
brow int8 2 (1,?) (True, False) brow int8 2 (1,?) (True, False)
bcol int8 2 (?,1) (False, True) bcol int8 2 (?,1) (False, True)
bmatrix int8 2 (?,?) (False, False) bmatrix int8 2 (?,?) (False, False)
btensor3 int8 3 (?,?,?) (False, False, False) btensor3 int8 3 (?,?,?) (False, False, False)
btensor4 int8 4 (?,?,?,?) (False, False, False, False) btensor4 int8 4 (?,?,?,?) (False, False, False, False)
wscalar int16 0 () () wscalar int16 0 () ()
wvector int16 1 (?,) (False,) wvector int16 1 (?,) (False,)
wrow int16 2 (1,?) (True, False) wrow int16 2 (1,?) (True, False)
wcol int16 2 (?,1) (False, True) wcol int16 2 (?,1) (False, True)
wmatrix int16 2 (?,?) (False, False) wmatrix int16 2 (?,?) (False, False)
wtensor3 int16 3 (?,?,?) (False, False, False) wtensor3 int16 3 (?,?,?) (False, False, False)
wtensor4 int16 4 (?,?,?,?) (False, False, False, False) wtensor4 int16 4 (?,?,?,?) (False, False, False, False)
iscalar int32 0 () () iscalar int32 0 () ()
ivector int32 1 (?,) (False,) ivector int32 1 (?,) (False,)
irow int32 2 (1,?) (True, False) irow int32 2 (1,?) (True, False)
icol int32 2 (?,1) (False, True) icol int32 2 (?,1) (False, True)
imatrix int32 2 (?,?) (False, False) imatrix int32 2 (?,?) (False, False)
itensor3 int32 3 (?,?,?) (False, False, False) itensor3 int32 3 (?,?,?) (False, False, False)
itensor4 int32 4 (?,?,?,?) (False, False, False, False) itensor4 int32 4 (?,?,?,?) (False, False, False, False)
lscalar int64 0 () () lscalar int64 0 () ()
lvector int64 1 (?,) (False,) lvector int64 1 (?,) (False,)
lrow int64 2 (1,?) (True, False) lrow int64 2 (1,?) (True, False)
lcol int64 2 (?,1) (False, True) lcol int64 2 (?,1) (False, True)
lmatrix int64 2 (?,?) (False, False) lmatrix int64 2 (?,?) (False, False)
ltensor3 int64 3 (?,?,?) (False, False, False) ltensor3 int64 3 (?,?,?) (False, False, False)
ltensor4 int64 4 (?,?,?,?) (False, False, False, False) ltensor4 int64 4 (?,?,?,?) (False, False, False, False)
dscalar float64 0 () () dscalar float64 0 () ()
dvector float64 1 (?,) (False,) dvector float64 1 (?,) (False,)
drow float64 2 (1,?) (True, False) drow float64 2 (1,?) (True, False)
dcol float64 2 (?,1) (False, True) dcol float64 2 (?,1) (False, True)
dmatrix float64 2 (?,?) (False, False) dmatrix float64 2 (?,?) (False, False)
dtensor3 float64 3 (?,?,?) (False, False, False) dtensor3 float64 3 (?,?,?) (False, False, False)
dtensor4 float64 4 (?,?,?,?) (False, False, False, False) dtensor4 float64 4 (?,?,?,?) (False, False, False, False)
fscalar float32 0 () () fscalar float32 0 () ()
fvector float32 1 (?,) (False,) fvector float32 1 (?,) (False,)
frow float32 2 (1,?) (True, False) frow float32 2 (1,?) (True, False)
fcol float32 2 (?,1) (False, True) fcol float32 2 (?,1) (False, True)
fmatrix float32 2 (?,?) (False, False) fmatrix float32 2 (?,?) (False, False)
ftensor3 float32 3 (?,?,?) (False, False, False) ftensor3 float32 3 (?,?,?) (False, False, False)
ftensor4 float32 4 (?,?,?,?) (False, False, False, False) ftensor4 float32 4 (?,?,?,?) (False, False, False, False)
cscalar complex64 0 () () cscalar complex64 0 () ()
cvector complex64 1 (?,) (False,) cvector complex64 1 (?,) (False,)
crow complex64 2 (1,?) (True, False) crow complex64 2 (1,?) (True, False)
ccol complex64 2 (?,1) (False, True) ccol complex64 2 (?,1) (False, True)
cmatrix complex64 2 (?,?) (False, False) cmatrix complex64 2 (?,?) (False, False)
ctensor3 complex64 3 (?,?,?) (False, False, False) ctensor3 complex64 3 (?,?,?) (False, False, False)
ctensor4 complex64 4 (?,?,?,?) (False, False, False, False) ctensor4 complex64 4 (?,?,?,?) (False, False, False, False)
zscalar complex128 0 () () zscalar complex128 0 () ()
zvector complex128 1 (?,) (False,) zvector complex128 1 (?,) (False,)
zrow complex128 2 (1,?) (True, False) zrow complex128 2 (1,?) (True, False)
zcol complex128 2 (?,1) (False, True) zcol complex128 2 (?,1) (False, True)
zmatrix complex128 2 (?,?) (False, False) zmatrix complex128 2 (?,?) (False, False)
ztensor3 complex128 3 (?,?,?) (False, False, False) ztensor3 complex128 3 (?,?,?) (False, False, False)
ztensor4 complex128 4 (?,?,?,?) (False, False, False, False) ztensor4 complex128 4 (?,?,?,?) (False, False, False, False)
============ =========== ==== =========== ================================= ============ =========== ==== =========== =================================
Plural Constructors Plural Constructors
-------------------------- --------------------------
There are several constructors that can produce multiple variables at once. There are several constructors that can produce multiple variables at once.
...@@ -188,7 +188,7 @@ These are not frequently used in practice, but often used in tutorial examples t ...@@ -188,7 +188,7 @@ These are not frequently used in practice, but often used in tutorial examples t
Return one or more matrix variables. Return one or more matrix variables.
Each of these plural constructors accepts Each of these plural constructors accepts
an integer or several strings. If an integer is provided, the method an integer or several strings. If an integer is provided, the method
will return that many Variables and if strings are provided, it will will return that many Variables and if strings are provided, it will
create one Variable for each string, using the string as the Variable's create one Variable for each string, using the string as the Variable's
...@@ -251,7 +251,7 @@ Finally, when you use a numpy ndarry or a Python number together with ...@@ -251,7 +251,7 @@ Finally, when you use a numpy ndarry or a Python number together with
Theano requires that the inputs to all expressions be Variable instances, so Theano requires that the inputs to all expressions be Variable instances, so
Theano automatically wraps them in a :class:`TensorConstant`. Theano automatically wraps them in a :class:`TensorConstant`.
.. note:: .. note::
Theano makes a copy of any ndarray that you use in an expression, so Theano makes a copy of any ndarray that you use in an expression, so
subsequent subsequent
...@@ -288,7 +288,7 @@ them perfectly, but a dscalar otherwise. ...@@ -288,7 +288,7 @@ them perfectly, but a dscalar otherwise.
When `x` is a `list` or `tuple` it is passed through numpy.asarray When `x` is a `list` or `tuple` it is passed through numpy.asarray
If the `ndim` argument is not None, it must be an integer and the output If the `ndim` argument is not None, it must be an integer and the output
will be broadcasted if necessary in order to have this many dimensions. will be broadcasted if necessary in order to have this many dimensions.
:rtype: :class:`TensorVariable` or :class:`TensorConstant` :rtype: :class:`TensorVariable` or :class:`TensorConstant`
...@@ -304,7 +304,7 @@ TensorType and TensorVariable ...@@ -304,7 +304,7 @@ TensorType and TensorVariable
:ref:`the tutorial's graph-structure figure <tutorial-graphfigure>` is an instance of this class. :ref:`the tutorial's graph-structure figure <tutorial-graphfigure>` is an instance of this class.
.. attribute:: broadcastable .. attribute:: broadcastable
A tuple of True/False values, one for each dimension. True in A tuple of True/False values, one for each dimension. True in
position 'i' indicates that at evaluation-time, the ndarray will have position 'i' indicates that at evaluation-time, the ndarray will have
size 1 in that 'i'-th dimension. Such a dimension is called a size 1 in that 'i'-th dimension. Such a dimension is called a
...@@ -349,7 +349,7 @@ TensorType and TensorVariable ...@@ -349,7 +349,7 @@ TensorType and TensorVariable
adding them together, we would define it like this: adding them together, we would define it like this:
>>> middle_broadcaster = TensorType('complex64', [False, True, False]) >>> middle_broadcaster = TensorType('complex64', [False, True, False])
.. attribute:: ndim .. attribute:: ndim
The number of dimensions that a Variable's value will have at The number of dimensions that a Variable's value will have at
...@@ -362,7 +362,7 @@ TensorType and TensorVariable ...@@ -362,7 +362,7 @@ TensorType and TensorVariable
the numerical type of the ndarray for which a Variable of this Type the numerical type of the ndarray for which a Variable of this Type
is standing. is standing.
.. _dtype_list: .. _dtype_list:
The dtype attribute of a TensorType instance can be any of the The dtype attribute of a TensorType instance can be any of the
following strings. following strings.
...@@ -386,7 +386,7 @@ TensorType and TensorVariable ...@@ -386,7 +386,7 @@ TensorType and TensorVariable
.. method:: __init__(self, dtype, broadcastable) .. method:: __init__(self, dtype, broadcastable)
If you wish to use a type of tensor which is not already available If you wish to use a type of tensor which is not already available
(for example, a 5D tensor) you can build an appropriate type by instantiating (for example, a 5D tensor) you can build an appropriate type by instantiating
:class:`TensorType`. :class:`TensorType`.
...@@ -433,7 +433,7 @@ TensorVariable ...@@ -433,7 +433,7 @@ TensorVariable
.. attribute:: dtype .. attribute:: dtype
The numeric type of this tensor. Aliased to The numeric type of this tensor. Aliased to
:attr:`TensorType.dtype`. :attr:`TensorType.dtype`.
.. method:: reshape(shape, ndim=None) .. method:: reshape(shape, ndim=None)
...@@ -476,10 +476,10 @@ TensorVariable ...@@ -476,10 +476,10 @@ TensorVariable
Transpose of this tensor. Transpose of this tensor.
>>> x = T.zmatrix() >>> x = T.zmatrix()
>>> y = 3+.2j * x.T >>> y = 3+.2j * x.T
.. note:: .. note::
In numpy and in Theano, the transpose of a vector is exactly the In numpy and in Theano, the transpose of a vector is exactly the
same vector! Use `reshape` or `dimshuffle` to turn your vector same vector! Use `reshape` or `dimshuffle` to turn your vector
into a row or column matrix. into a row or column matrix.
...@@ -510,20 +510,20 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`. ...@@ -510,20 +510,20 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`.
:rtype: variable with x's dtype, but ndim dimensions :rtype: variable with x's dtype, but ndim dimensions
.. note:: .. note::
This function can infer the length of a symbolic newshape in some This function can infer the length of a symbolic newshape in some
cases, but if it cannot and you do not provide the `ndim`, then this cases, but if it cannot and you do not provide the `ndim`, then this
function will raise an Exception. function will raise an Exception.
.. function:: shape_padleft(x, n_ones=1) .. function:: shape_padleft(x, n_ones=1)
Reshape `x` by left padding the shape with `n_ones` 1s. Note that all Reshape `x` by left padding the shape with `n_ones` 1s. Note that all
this new dimension will be broadcastable. To make them non-broadcastable this new dimension will be broadcastable. To make them non-broadcastable
see the :func:`unbroadcast`. see the :func:`unbroadcast`.
:param x: variable to be reshaped :param x: variable to be reshaped
:type x: any TensorVariable (or compatible) :type x: any TensorVariable (or compatible)
:type n_ones: int :type n_ones: int
...@@ -533,11 +533,11 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`. ...@@ -533,11 +533,11 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`.
.. function:: shape_padright(x,n_ones = 1) .. function:: shape_padright(x,n_ones = 1)
Reshape `x` by right padding the shape with `n_ones` 1s. Note that all Reshape `x` by right padding the shape with `n_ones` 1s. Note that all
this new dimension will be broadcastable. To make them non-broadcastable this new dimension will be broadcastable. To make them non-broadcastable
see the :func:`unbroadcast`. see the :func:`unbroadcast`.
:param x: variable to be reshaped :param x: variable to be reshaped
:type x: any TensorVariable (or compatible) :type x: any TensorVariable (or compatible)
:type n_ones: int :type n_ones: int
...@@ -557,7 +557,7 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`. ...@@ -557,7 +557,7 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`.
along that dimension is not 1, a ``ValueError`` will be raised. along that dimension is not 1, a ``ValueError`` will be raised.
.. function:: flatten(x, outdim=1) .. function:: flatten(x, outdim=1)
Similar to :func:`reshape`, but the shape is inferred from the shape of `x`. Similar to :func:`reshape`, but the shape is inferred from the shape of `x`.
:param x: variable to be flattened :param x: variable to be flattened
...@@ -591,7 +591,7 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`. ...@@ -591,7 +591,7 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`.
.. function:: fill(a,b) .. function:: fill(a,b)
:param a: tensor that has same shape as output :param a: tensor that has same shape as output
:param b: theano scalar or value with which you want to fill the output :param b: theano scalar or value with which you want to fill the output
Create a matrix by filling the shape of `a` with `b` Create a matrix by filling the shape of `a` with `b`
...@@ -600,9 +600,9 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`. ...@@ -600,9 +600,9 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`.
:param n: number of rows in output (value or theano scalar) :param n: number of rows in output (value or theano scalar)
:param m: number of columns in output (value or theano scalar) :param m: number of columns in output (value or theano scalar)
:param k: Index of the diagonal: 0 refers to the main diagonal, :param k: Index of the diagonal: 0 refers to the main diagonal,
a positive value refers to an upper diagonal, and a a positive value refers to an upper diagonal, and a
negative value to a lower diagonal. It can be a theano negative value to a lower diagonal. It can be a theano
scalar. scalar.
:returns: An array where all elements are equal to zero, except for the `k`-th :returns: An array where all elements are equal to zero, except for the `k`-th
diagonal, whose values are equal to one. diagonal, whose values are equal to one.
...@@ -644,7 +644,7 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`. ...@@ -644,7 +644,7 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`.
>>> # x.ndim == 2 >>> # x.ndim == 2
Reductions Reductions
========== ==========
...@@ -654,7 +654,7 @@ Reductions ...@@ -654,7 +654,7 @@ Reductions
:Parameter: *axis* - axis along which to compute the maximum :Parameter: *axis* - axis along which to compute the maximum
:Returns: the maximum value along a given axis :Returns: the maximum value along a given axis
:note: see maximum for elemwise max :note: see maximum for elemwise max
if axis=None, Theano 0.5rc1 or later: max over the flattened tensor (like numpy) if axis=None, Theano 0.5rc1 or later: max over the flattened tensor (like numpy)
older: then axis is assumed to be ndim(x)-1 older: then axis is assumed to be ndim(x)-1
...@@ -834,7 +834,7 @@ Casting ...@@ -834,7 +834,7 @@ Casting
Cast any tensor `x` to a Tensor of the same shape, but with a different Cast any tensor `x` to a Tensor of the same shape, but with a different
numerical type `dtype`. numerical type `dtype`.
This is not a reinterpret cast, but a coersion cast, similar to This is not a reinterpret cast, but a coersion cast, similar to
``numpy.asarray(x, dtype=dtype)``. ``numpy.asarray(x, dtype=dtype)``.
...@@ -850,12 +850,12 @@ Casting ...@@ -850,12 +850,12 @@ Casting
.. function:: real(x) .. function:: real(x)
Return the real (not imaginary) components of Tensor x. Return the real (not imaginary) components of Tensor x.
For non-complex `x` this function returns x. For non-complex `x` this function returns x.
.. function:: imag(x) .. function:: imag(x)
Return the imaginary components of Tensor x. Return the imaginary components of Tensor x.
For non-complex `x` this function returns zeros_like(x). For non-complex `x` this function returns zeros_like(x).
...@@ -875,7 +875,7 @@ The six usual equality and inequality operators share the same interface. ...@@ -875,7 +875,7 @@ The six usual equality and inequality operators share the same interface.
Here is an example with the less-than operator. Here is an example with the less-than operator.
.. code-block:: python .. code-block:: python
import theano.tensor as T import theano.tensor as T
x,y = T.dmatrices('x','y') x,y = T.dmatrices('x','y')
...@@ -927,7 +927,7 @@ Condition ...@@ -927,7 +927,7 @@ Condition
:Parameter: *iff* - symbolic Tensor (or compatible) :Parameter: *iff* - symbolic Tensor (or compatible)
:Return type: symbolic Tensor :Return type: symbolic Tensor
.. code-block:: python .. code-block:: python
import theano.tensor as T import theano.tensor as T
a,b = T.dmatrices('a','b') a,b = T.dmatrices('a','b')
...@@ -945,14 +945,14 @@ Bit-wise ...@@ -945,14 +945,14 @@ Bit-wise
-------- --------
The bitwise operators possess this interface: The bitwise operators possess this interface:
:Parameter: *a* - symbolic Tensor of integer type. :Parameter: *a* - symbolic Tensor of integer type.
:Parameter: *b* - symbolic Tensor of integer type. :Parameter: *b* - symbolic Tensor of integer type.
.. note:: .. note::
The bitwise operators must have an integer type as input. The bitwise operators must have an integer type as input.
The bit-wise not (invert) takes only one parameter. The bit-wise not (invert) takes only one parameter.
:Return type: symbolic Tensor with corresponding dtype. :Return type: symbolic Tensor with corresponding dtype.
...@@ -991,7 +991,7 @@ The bitwise operators possess this interface: ...@@ -991,7 +991,7 @@ The bitwise operators possess this interface:
Here is an example using the bit-wise ``and_`` via the ``&`` operator: Here is an example using the bit-wise ``and_`` via the ``&`` operator:
.. code-block:: python .. code-block:: python
import theano.tensor as T import theano.tensor as T
x,y = T.imatrices('x','y') x,y = T.imatrices('x','y')
...@@ -1137,7 +1137,7 @@ Linear Algebra ...@@ -1137,7 +1137,7 @@ Linear Algebra
:param Y: right term :param Y: right term
:type X: symbolic vector :type X: symbolic vector
:type Y: symbolic vector :type Y: symbolic vector
:rtype: symbolic matrix :rtype: symbolic matrix
:return: vector-vector outer product :return: vector-vector outer product
...@@ -1150,7 +1150,7 @@ Linear Algebra ...@@ -1150,7 +1150,7 @@ Linear Algebra
:param axes: sum out these axes from X and Y. :param axes: sum out these axes from X and Y.
:type X: symbolic tensor :type X: symbolic tensor
:type Y: symbolic tensor :type Y: symbolic tensor
:rtype: symbolic tensor :rtype: symbolic tensor
:type axes: see numpy.tensordot :type axes: see numpy.tensordot
:return: tensor product :return: tensor product
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论