提交 a2168c05 authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Merge pull request #1351 from nouiz/doc_mkl

Add a note in the doc with URL to help link with MKL.
...@@ -438,6 +438,14 @@ correctly (for example, for MKL this might be ``-lmkl -lguide -lpthread`` or ...@@ -438,6 +438,14 @@ correctly (for example, for MKL this might be ``-lmkl -lguide -lpthread`` or
This might be just a problem with the way Theano passes compilation This might be just a problem with the way Theano passes compilation
arguments to g++, but the problem is not fixed yet. arguments to g++, but the problem is not fixed yet.
.. note::
If you have problems linking with MKL, `Intel Line Advisor
<http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor>`_
and `MKL User Guide
<http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mkl_userguide_lnx/index.htm>`_
can help you find the correct flag to use.
.. _gpu_linux: .. _gpu_linux:
Using the GPU Using the GPU
......
...@@ -646,6 +646,35 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`. ...@@ -646,6 +646,35 @@ dimensions, see :meth:`_tensor_py_operators.dimshuffle`.
>>> x = T.concatenate([x0, x1[0], T.shape_padright(x2)], axis=1) >>> x = T.concatenate([x0, x1[0], T.shape_padright(x2)], axis=1)
>>> # x.ndim == 2 >>> # x.ndim == 2
.. function:: stacklist(tensor_list)
:type tensor_list: an iterable that contain tensors or iterable
with at the end tensors.
:param tensor_list: tensors to be
stackend together.
Recursivly stack lists of tensors to maintain similar structure.
This function can create a tensor from a shaped list of scalars
>>> from theano.tensor import stacklists, scalars, matrices
>>> from theano import function
>>> a,b,c,d = scalars('abcd')
>>> X = stacklists([[a, b], [c, d]])
>>> f = function([a, b, c, d], X)
>>> f(1, 2, 3, 4)
>>> # array([[ 1., 2.], [ 3., 4.]], dtype=float32)
We can also stack arbitrarily shaped tensors. Here we stack matrices into
a 2 by 2 grid.
>>> from numpy import ones
>>> a,b,c,d, = matrices('abcd')
>>> X = stacklists([[a, b], [c, d]])
>>> f = function([a, b, c, d], X)
>>> x = ones((4, 4), 'float32')
>>> f(x, x, x, x).shape
>>> # (2, 2, 4, 4)
Reductions Reductions
========== ==========
...@@ -800,7 +829,7 @@ Reductions ...@@ -800,7 +829,7 @@ Reductions
inner summation. This will not necessarily be the dtype of the inner summation. This will not necessarily be the dtype of the
output (in particular if it is a discrete (int/uint) dtype, the output (in particular if it is a discrete (int/uint) dtype, the
output will be in a float type). If None, then we use the same output will be in a float type). If None, then we use the same
rules as :ref:`sum()`. rules as :func:`sum()`.
:Returns: mean value of *x* along *axis* :Returns: mean value of *x* along *axis*
axis can be: axis can be:
......
...@@ -8234,15 +8234,16 @@ def diag(v, k=0): ...@@ -8234,15 +8234,16 @@ def diag(v, k=0):
else: else:
raise ValueError("Input must be 1- or 2-d.") raise ValueError("Input must be 1- or 2-d.")
def stacklists(arg): def stacklists(arg):
""" Recursivly stack lists of tensors to maintain similar structure """ Recursivly stack lists of tensors to maintain similar structure
This function can create a tensor from a shaped list of scalars This function can create a tensor from a shaped list of scalars
>>> from theano.tensor import stacklists, scalar, matrix
>>> from theano.tensor import stacklists, scalars, matrices
>>> from theano import function >>> from theano import function
>>> a,b,c,d = map(scalar, 'abcd') >>> a,b,c,d = scalars('abcd')
>>> X = stacklists([[a, b], >>> X = stacklists([[a, b], [c, d]])
... [c, d]])
>>> f = function([a, b, c, d], X) >>> f = function([a, b, c, d], X)
>>> f(1, 2, 3, 4) >>> f(1, 2, 3, 4)
array([[ 1., 2.], array([[ 1., 2.],
...@@ -8250,10 +8251,10 @@ def stacklists(arg): ...@@ -8250,10 +8251,10 @@ def stacklists(arg):
We can also stack arbitrarily shaped tensors. Here we stack matrices into We can also stack arbitrarily shaped tensors. Here we stack matrices into
a 2 by 2 grid. a 2 by 2 grid.
>>> from numpy import ones >>> from numpy import ones
>>> a,b,c,d, = [tensor.matrix(a) for a in 'abcd'] >>> a,b,c,d, = matrices('abcd')
>>> X = stacklists([[a, b], >>> X = stacklists([[a, b], [c, d]])
... [c, d]])
>>> f = function([a, b, c, d], X) >>> f = function([a, b, c, d], X)
>>> x = ones((4, 4), 'float32') >>> x = ones((4, 4), 'float32')
>>> f(x, x, x, x).shape >>> f(x, x, x, x).shape
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论