Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
39ee11ff
提交
39ee11ff
authored
7月 26, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CRASH] remove assert in opt and silence it as it is normal that it can't be applied.
上级
8da054b7
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
16 行增加
和
12 行删除
+16
-12
opt.py
theano/tensor/opt.py
+7
-12
test_opt.py
theano/tensor/tests/test_opt.py
+9
-0
没有找到文件。
theano/tensor/opt.py
浏览文件 @
39ee11ff
...
@@ -1626,18 +1626,13 @@ def local_upcast_elemwise_constant_inputs(node):
...
@@ -1626,18 +1626,13 @@ def local_upcast_elemwise_constant_inputs(node):
if
new_inputs
!=
node
.
inputs
:
if
new_inputs
!=
node
.
inputs
:
rval
=
[
node
.
op
(
*
new_inputs
)]
rval
=
[
node
.
op
(
*
new_inputs
)]
if
rval
[
0
]
.
type
!=
node
.
outputs
[
0
]
.
type
:
if
rval
[
0
]
.
type
!=
node
.
outputs
[
0
]
.
type
:
print
>>
sys
.
stderr
,
"NODE:"
,
node
# This can happen for example when floatX=float32
print
>>
sys
.
stderr
,
"NODE INPUT TYPES:"
,
[
i
.
type
for
i
# and we do the true division between and int64
in
node
.
inputs
]
# and a constant that will get typed as int8.
print
>>
sys
.
stderr
,
"NODE OUTPUT TYPES:"
,
[
o
.
type
for
o
in
node
.
outputs
]
# As this is just to allow merging more case, if
print
>>
sys
.
stderr
,
"RVAL:"
,
rval
# the upcast don't work, we can just skip it.
print
>>
sys
.
stderr
,
"NEW INPUT TYPES:"
,
[
i
.
type
for
i
return
in
new_inputs
]
print
>>
sys
.
stderr
,
"RVAL INPUT TYPES:"
,
[
i
.
type
for
i
in
rval
[
0
]
.
owner
.
inputs
]
print
>>
sys
.
stderr
,
"RVAL TYPES:"
,
[
o
.
type
for
o
in
rval
]
assert
rval
[
0
]
.
type
==
node
.
outputs
[
0
]
.
type
,
(
node
,
rval
[
0
])
return
rval
return
rval
##################
##################
...
...
theano/tensor/tests/test_opt.py
浏览文件 @
39ee11ff
...
@@ -4204,6 +4204,15 @@ def test_local_upcast_elemwise_constant_inputs():
...
@@ -4204,6 +4204,15 @@ def test_local_upcast_elemwise_constant_inputs():
f
=
function
([
s
],
[
tensor
.
grad
(
x
,
s
)])
f
=
function
([
s
],
[
tensor
.
grad
(
x
,
s
)])
f
([
-
42
,
-
2.1
,
-
1
,
-
0.5
,
0
,
0.2
,
1
,
2
,
12
])
f
([
-
42
,
-
2.1
,
-
1
,
-
0.5
,
0
,
0.2
,
1
,
2
,
12
])
# This test a corner where the optimization should not be applied.
old
=
theano
.
config
.
floatX
theano
.
config
.
floatX
=
'float32'
try
:
v
=
lvector
()
/
2
function
([
v
],
theano
.
tensor
.
basic
.
true_div
(
v
,
2
))
finally
:
theano
.
config
.
floatX
=
old
class
TestShape_i
(
utt
.
InferShapeTester
):
class
TestShape_i
(
utt
.
InferShapeTester
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论