Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
01f44306
提交
01f44306
authored
2月 22, 2012
作者:
nouiz
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #472 from lamblin/fix_local_upcast_elemwise_constant_inputs
Fix local_upcast_elemwise_constant_inputs optimization
上级
aa5ed7d9
6b478b5b
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
12 行增加
和
1 行删除
+12
-1
NEWS.txt
NEWS.txt
+3
-0
opt.py
theano/tensor/opt.py
+3
-1
test_opt.py
theano/tensor/tests/test_opt.py
+6
-0
没有找到文件。
NEWS.txt
浏览文件 @
01f44306
...
@@ -9,6 +9,9 @@ Bug fixes (the result changed):
...
@@ -9,6 +9,9 @@ Bug fixes (the result changed):
Crashes fixes:
Crashes fixes:
* More cases supported in AdvancedIncSubtensor1. (Olivier D.)
* More cases supported in AdvancedIncSubtensor1. (Olivier D.)
* Fix crash when a broadcasted constant was used as input of an
elemwise Op and needed to be upcasted to match the op's output.
(Reported by John Salvatier, fixed by Pascal L.)
Interface change:
Interface change:
* The Theano flag "nvcc.flags" is now included in the hard part of the key.
* The Theano flag "nvcc.flags" is now included in the hard part of the key.
...
...
theano/tensor/opt.py
浏览文件 @
01f44306
...
@@ -1443,7 +1443,9 @@ def local_upcast_elemwise_constant_inputs(node):
...
@@ -1443,7 +1443,9 @@ def local_upcast_elemwise_constant_inputs(node):
# works only for scalars
# works only for scalars
cval_i
=
get_constant_value
(
i
)
cval_i
=
get_constant_value
(
i
)
if
all
(
i
.
broadcastable
):
if
all
(
i
.
broadcastable
):
new_inputs
.
append
(
T
.
cast
(
cval_i
,
output_dtype
))
new_inputs
.
append
(
T
.
shape_padleft
(
T
.
cast
(
cval_i
,
output_dtype
),
i
.
ndim
))
else
:
else
:
if
shape_i
is
None
:
if
shape_i
is
None
:
return
return
...
...
theano/tensor/tests/test_opt.py
浏览文件 @
01f44306
...
@@ -3532,6 +3532,12 @@ class Test_lift_transpose_through_dot(unittest.TestCase):
...
@@ -3532,6 +3532,12 @@ class Test_lift_transpose_through_dot(unittest.TestCase):
assert
str
(
g
)
==
sg
assert
str
(
g
)
==
sg
def
test_local_upcast_elemwise_constant_inputs
():
s
=
dvector
(
"s"
)
x
=
tensor
.
sum
(
tensor
.
log
(
10
**
s
))
f
=
function
([
s
],
[
tensor
.
grad
(
x
,
s
)])
f
([
-
42
,
-
2.1
,
-
1
,
-
0.5
,
0
,
0.2
,
1
,
2
,
12
])
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
# unittest.main()
# unittest.main()
test_fusion
()
.
tes_memory_leak
()
test_fusion
()
.
tes_memory_leak
()
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论