Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b3965fab
提交
b3965fab
authored
4月 22, 2011
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Small reformulations in doc.
上级
ebfa6163
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
16 行增加
和
13 行删除
+16
-13
shape_info.txt
doc/tutorial/shape_info.txt
+16
-13
没有找到文件。
doc/tutorial/shape_info.txt
浏览文件 @
b3965fab
...
...
@@ -38,11 +38,11 @@ output.
Shape inference problem
=======================
Theano
do shape information propag
ation in the graph. Sometimes this
can
had error. E
xample:
Theano
propagates shape inform
ation in the graph. Sometimes this
can
lead to errors. For e
xample:
.. code-block:: python
import numpy
import theano
x = theano.tensor.matrix('x')
...
...
@@ -71,10 +71,10 @@ can had error. Example:
# |Shape_i{1} [@55959184] '' 0
# | |<TensorType(float64, matrix)> [@55583888]
print f(xv,yv)# DO
N
T RAISE AN ERROR AS SHOULD BE.
print f(xv,yv)# DO
ES NO
T RAISE AN ERROR AS SHOULD BE.
#[8,4]
f = theano.function([x,y], z)# Do
n'
t take the shape.
f = theano.function([x,y], z)# Do
no
t take the shape.
theano.printing.debugprint(f)
#Join [@44540496] '' 0
# |0 [@44540432]
...
...
@@ -84,22 +84,25 @@ can had error. Example:
f(xv,yv)
# Raise a dimensions mismatch error.
As you see, when you ask for the shape of some computation(join in the
example), we sometimes compute
the shape without executing the
computation
(there is no join in the first output or debugprint).
As you see, when you ask for the shape of some computation
(join in the
example), we sometimes compute
an inferred shape directly, without executing
the computation itself
(there is no join in the first output or debugprint).
This make
the computation of the shape faster, but can hide error
. In
This make
s the computation of the shape faster, but it can hide errors
. In
the example, the computation of the shape of join is done on the first
theano variable in the join, not on the other.
This can probably happen with many other op as elemwise, dot, ...
Indeed, to make some optimizations (for speed or stability, for instance),
Theano can assume that the computation is correct and consistent
in the first place, this is the case here.
You can detect those problem by running the code without this
optimization
with the t
heano flag
optimization
, with the T
heano flag
`optimizer_excluding=local_shape_to_shape_i`. You can also have the
same effect by running in the mode FAST_COMPILE
(won'
t apply this
optimization
and most other optimization too) or DEBUG_MODE(
will test
before and after all optimizations(much slower)).
same effect by running in the mode FAST_COMPILE
(it will no
t apply this
optimization
, nor most other optimizations) or DEBUG_MODE (it
will test
before and after all optimizations
(much slower)).
Specifing exact shape
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论