Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
2abad4b7
提交
2abad4b7
authored
10月 26, 2015
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More fixes to doc syntax.
上级
627d9bf7
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
68 行增加
和
67 行删除
+68
-67
basic.txt
doc/library/tensor/basic.txt
+5
-2
debug_faq.txt
doc/tutorial/debug_faq.txt
+1
-1
extending_theano_c.txt
doc/tutorial/extending_theano_c.txt
+1
-1
gradient.py
theano/gradient.py
+32
-39
var.py
theano/sandbox/cuda/var.py
+10
-7
neighbours.py
theano/tensor/nnet/neighbours.py
+19
-17
没有找到文件。
doc/library/tensor/basic.txt
浏览文件 @
2abad4b7
...
@@ -750,8 +750,10 @@ Creating Tensor
...
@@ -750,8 +750,10 @@ Creating Tensor
.. function:: stack(*tensors)
.. function:: stack(*tensors)
.. warning:: The interface stack(*tensors) is deprecated!
.. warning::
Use stack(tensors, axis=0) instead.
The interface `stack(*tensors)` is deprecated! Use
`stack(tensors, axis=0)` instead.
Stack tensors in sequence vertically (row wise).
Stack tensors in sequence vertically (row wise).
...
@@ -1773,6 +1775,7 @@ Gradient / Differentiation
...
@@ -1773,6 +1775,7 @@ Gradient / Differentiation
.. automodule:: theano.gradient
.. automodule:: theano.gradient
:members: grad
:members: grad
:noindex:
See the :ref:`gradient <libdoc_gradient>` page for complete documentation
See the :ref:`gradient <libdoc_gradient>` page for complete documentation
of the gradient module.
of the gradient module.
doc/tutorial/debug_faq.txt
浏览文件 @
2abad4b7
...
@@ -181,7 +181,7 @@ of error can thus be identified with much more precision and much earlier in
...
@@ -181,7 +181,7 @@ of error can thus be identified with much more precision and much earlier in
the compilation pipeline. For example, running the above code yields the
the compilation pipeline. For example, running the above code yields the
following error message, which properly identifies *line 24* as the culprit.
following error message, which properly identifies *line 24* as the culprit.
.. code-block:: no
d
e
.. code-block:: no
n
e
Traceback (most recent call last):
Traceback (most recent call last):
File "test2.py", line 24, in <module>
File "test2.py", line 24, in <module>
...
...
doc/tutorial/extending_theano_c.txt
浏览文件 @
2abad4b7
...
@@ -878,7 +878,7 @@ pre-defined macros. These section tags have no macros: ``init_code``,
...
@@ -878,7 +878,7 @@ pre-defined macros. These section tags have no macros: ``init_code``,
discussed below.
discussed below.
* ``APPLY_SPECIFIC(str)`` which will automatically append a name
* ``APPLY_SPECIFIC(str)`` which will automatically append a name
unique to the :ref:`Apply node that applies the Op at the end
unique to the :ref:`Apply
`
node that applies the Op at the end
of the provided ``str``. The use of this macro is discussed
of the provided ``str``. The use of this macro is discussed
futher below.
futher below.
...
...
theano/gradient.py
浏览文件 @
2abad4b7
...
@@ -371,58 +371,51 @@ def grad(cost, wrt, consider_constant=None,
...
@@ -371,58 +371,51 @@ def grad(cost, wrt, consider_constant=None,
see :mod:`gradient`. For information on how to implement the gradient of
see :mod:`gradient`. For information on how to implement the gradient of
a certain Op, see :func:`grad`.
a certain Op, see :func:`grad`.
:type cost: Scalar (0-dimensional) tensor variable.
Parameters
May optionally be None if known_grads is provided.
----------
:param cost: a scalar with respect to which we are differentiating
cost : scalar (0-dimensional) tensor variable or None
Value with respect to which we are differentiating. May be
`None` if known_grads is provided.
wrt : variable or list of variables
term[s] for which we want gradients
consider_constant : list of variables
expressions not to backpropagate through
disconnected_inputs : {'ignore', 'warn', 'raise'}
Defines the behaviour if some of the variables in `wrt` are
not part of the computational graph computing `cost` (or if
all links are non-differentiable). The possible values are:
:type wrt: Tensor variable or list of variables.
:param wrt: term[s] for which we want gradients
:type consider_constant: list of variables
:param consider_constant: a list of expressions not to backpropagate
through
:type disconnected_inputs: string
:param disconnected_inputs: Defines the behaviour if some of the variables
in ``wrt`` are not part of the computational graph computing ``cost``
(or if all links are non-differentiable). The possible values are:
- 'ignore': considers that the gradient on these parameters is zero.
- 'ignore': considers that the gradient on these parameters is zero.
- 'warn': consider the gradient zero, and print a warning.
- 'warn': consider the gradient zero, and print a warning.
- 'raise': raise DisconnectedInputError.
- 'raise': raise DisconnectedInputError.
add_names : bool
:type add_names: bool
If True, variables generated by grad will be named
:param add_names: If True, variables generated by grad will be named
(d<cost.name>/d<wrt.name>) provided that both cost and wrt
(d<cost.name>/d<wrt.name>) provided that both cost and wrt have
have names
names
known_grads : dict, optional
A dictionary mapping variables to their gradients. This is
:type known_grads: dict
useful in the case where you know the gradient on some
:param known_grads: If not None, a dictionary mapping variables to their
variables but do not know the original cost.
gradients. This is useful in the case where you know the
return_disconnected : {'zero', 'None', 'Disconnected'}
gradient on some variables but do not know the original
cost.
:type return_disconnected: string
:param return_disconnected:
- 'zero' : If wrt[i] is disconnected, return value i will be
- 'zero' : If wrt[i] is disconnected, return value i will be
wrt[i].zeros_like()
wrt[i].zeros_like()
- 'None' : If wrt[i] is disconnected, return value i will be
- 'None' : If wrt[i] is disconnected, return value i will be
None
None
- 'Disconnected' : returns variables of type DisconnectedType
- 'Disconnected' : returns variables of type DisconnectedType
null_gradients : {'raise', 'return'}
Defines the behaviour if some of the variables in `wrt` have a
null gradient. The possibles values are:
:type null_gradients: string
:param null_gradients: Defines the behaviour if some of the variables in
``wrt`` have a null gradient. The possibles values are :
- 'raise' : raise a NullTypeGradError exception
- 'raise' : raise a NullTypeGradError exception
- 'return' : return the null gradients
- 'return' : return the null gradients
:rtype: variable or list/tuple of Variables (matching `wrt`)
Returns
-------
:return: symbolic expression of gradient of `cost` with respect to each
variable or list/tuple of variables (matches `wrt`)
of the `wrt` terms.
symbolic expression of gradient of `cost` with respect to each
If an element of `wrt` is not differentiable with respect
of the `wrt` terms. If an element of `wrt` is not
to the output, then a zero variable is returned.
differentiable with respect to the output, then a zero
It returns an object of same type as `wrt`: a list/tuple
variable is returned.
or Variable in all cases.
"""
"""
t0
=
time
.
time
()
t0
=
time
.
time
()
...
...
theano/sandbox/cuda/var.py
浏览文件 @
2abad4b7
...
@@ -126,14 +126,17 @@ class CudaNdarraySharedVariable(_operators, SharedVariable):
...
@@ -126,14 +126,17 @@ class CudaNdarraySharedVariable(_operators, SharedVariable):
* The destination on the GPU must be c_contiguous.
* The destination on the GPU must be c_contiguous.
* The source is on the CPU.
* The source is on the CPU.
* The old value must have the same dtype as the new value (which is
* The old value must have the same dtype as the new value
a given for now, since only float32 is supported).
(which is a given for now, since only float32 is
supported).
* The old and new value must have the same shape.
* The old and new value must have the same shape.
* The old value is being completely replaced by the new value (not
* The old value is being completely replaced by the new
partially modified, e.g. by replacing some subtensor of it).
value (not partially modified, e.g. by replacing some
* You change the value of the shared variable via set_value, not via
subtensor of it).
the .value accessors. You should not use the .value accessors
* You change the value of the shared variable via
anyway, since they will soon be deprecated and removed.
set_value, not via the .value accessors. You should not
use the .value accessors anyway, since they will soon be
deprecated and removed.
It is also worth mentioning that, for efficient transfer to the GPU,
It is also worth mentioning that, for efficient transfer to the GPU,
Theano will make the new data ``c_contiguous``. This can require an
Theano will make the new data ``c_contiguous``. This can require an
...
...
theano/tensor/nnet/neighbours.py
浏览文件 @
2abad4b7
...
@@ -14,22 +14,20 @@ from theano.gradient import grad_undefined
...
@@ -14,22 +14,20 @@ from theano.gradient import grad_undefined
class
Images2Neibs
(
Op
):
class
Images2Neibs
(
Op
):
"""
"""
Reshapes the input as a 2D tensor where each row is an pooling
example.
Parameters
Parameters
----------
----------
mode : {'valid', 'ignore_borders', 'wrap_centered'}
mode : {'valid', 'ignore_borders', 'wrap_centered'}
'valid': Requires an input that is a multiple of the
- 'valid' :
pooling factor (in each direction).
Requires an input that is a multiple of the pooling factor
'ignore_borders': Same as valid, but will ignore the borders
(in each direction).
if the shape(s) of the input is not a multiple of the pooling
- 'ignore_borders' :
factor(s).
Same as valid, but will ignore the borders if the shape(s)
'wrap_centered' : ?? TODO comment
of the input is not a multiple of the pooling factor(s).
- 'wrap_centered' :
Returns
?? TODO comment
-------
object
Reshapes the input as a 2D tensor where each row is an
pooling example.
"""
"""
...
@@ -429,7 +427,7 @@ class Images2Neibs(Op):
...
@@ -429,7 +427,7 @@ class Images2Neibs(Op):
def
images2neibs
(
ten4
,
neib_shape
,
neib_step
=
None
,
mode
=
'valid'
):
def
images2neibs
(
ten4
,
neib_shape
,
neib_step
=
None
,
mode
=
'valid'
):
"""
"""
Function :func:`images2neibs <theano.
sandbox
.neighbours.images2neibs>`
Function :func:`images2neibs <theano.
tensor.nnet
.neighbours.images2neibs>`
allows to apply a sliding window operation to a tensor containing
allows to apply a sliding window operation to a tensor containing
images or other two-dimensional objects.
images or other two-dimensional objects.
The sliding window operation loops over points in input data and stores
The sliding window operation loops over points in input data and stores
...
@@ -455,9 +453,6 @@ def images2neibs(ten4, neib_shape, neib_step=None, mode='valid'):
...
@@ -455,9 +453,6 @@ def images2neibs(ten4, neib_shape, neib_step=None, mode='valid'):
By default it is equal to `neib_shape` in other words, the patches are
By default it is equal to `neib_shape` in other words, the patches are
disjoint. When the step is greater than `neib_shape`, some elements are
disjoint. When the step is greater than `neib_shape`, some elements are
omitted. When None, this is the same as neib_shape (patch are disjoint).
omitted. When None, this is the same as neib_shape (patch are disjoint).
.. note:: Currently the step size should be chosen in the way that the
corresponding dimension :math:`i` (width or height) is equal to
:math:`n * step
\
_size_i + neib
\
_shape_i` for some :math:`n`
mode : {'valid', 'ignore_borders', 'wrap_centered'}
mode : {'valid', 'ignore_borders', 'wrap_centered'}
``valid``
``valid``
Requires an input that is a multiple of the
Requires an input that is a multiple of the
...
@@ -489,6 +484,13 @@ def images2neibs(ten4, neib_shape, neib_step=None, mode='valid'):
...
@@ -489,6 +484,13 @@ def images2neibs(ten4, neib_shape, neib_step=None, mode='valid'):
these for loops, they're just the easiest way to describe the
these for loops, they're just the easiest way to describe the
output pattern.
output pattern.
Notes
-----
.. note::
Currently the step size should be chosen in the way that the
corresponding dimension :math:`i` (width or height) is equal
to :math:`n * step
\
_size_i + neib
\
_shape_i` for some :math:`n`.
Examples
Examples
--------
--------
...
@@ -524,7 +526,7 @@ def neibs2images(neibs, neib_shape, original_shape, mode='valid'):
...
@@ -524,7 +526,7 @@ def neibs2images(neibs, neib_shape, original_shape, mode='valid'):
Parameters
Parameters
----------
----------
neibs
: matrix
neibs
: 2d tensor
Like the one obtained by
Like the one obtained by
:func:`images2neibs <theano.sandbox.neigbours.neibs2images>`.
:func:`images2neibs <theano.sandbox.neigbours.neibs2images>`.
neib_shape
neib_shape
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论