Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
3cf18963
提交
3cf18963
authored
8月 19, 2009
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
差异文件
merge
上级
c3f2fa12
e962a84d
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
39 行增加
和
2 行删除
+39
-2
profilemode.py
theano/compile/profilemode.py
+0
-1
test_misc.py
theano/tensor/tests/test_misc.py
+39
-1
没有找到文件。
theano/compile/profilemode.py
浏览文件 @
3cf18963
...
...
@@ -87,7 +87,6 @@ class ProfileMode(Mode):
flops_msg
=
''
for
a
,
t
in
op_time
.
items
():
if
hasattr
(
a
,
'flops'
):
print
"if true!"
flops
=
True
flops_msg
=
' <MFlops/s>'
print
'
\n
HACK WARNING: we print the flops for some OP, but the logic don
\'
always work. You need to know the internal of Theano to make it work correctly. Otherwise don
\'
t use!'
...
...
theano/tensor/tests/test_misc.py
浏览文件 @
3cf18963
import
sys
import
copy
,
sys
import
numpy
,
theano
from
theano
import
tensor
from
theano.tensor.nnet
import
crossentropy_softmax_argmax_1hot_with_bias
def
test_bug_2009_06_02_trac_387
():
...
...
@@ -31,3 +32,40 @@ def test_bug_2009_07_17_borrowed_output():
print
z
# Should still be zero.
assert
numpy
.
linalg
.
norm
(
z
)
==
0
# The code above was supposed to fail when it was written (or, more
# accurately, on the next revision, i.e. when it was merged with the
# rest of the code, i.e. on revision cac9c9e9f08e).
# However, for some reason, it does not fail anymore when at this revision.
# Thus, a new test (below) was added that exhibits the same issue. Note
# that it may better be moved into the test_nnet.py test file if it turns
# out the bug was caused by 'crossentropy_softmax_argmax_1hot_with_bias',
# and was not a more general issue.
test_output_activation_no_bias
=
theano
.
tensor
.
dmatrix
()
test_b2
=
theano
.
tensor
.
dvector
()
test_target
=
theano
.
tensor
.
ivector
()
nll_softmax_argmax
=
(
crossentropy_softmax_argmax_1hot_with_bias
(
test_output_activation_no_bias
,
test_b2
,
test_target
))
output
=
nll_softmax_argmax
[
1
]
g
=
theano
.
function
([
test_output_activation_no_bias
,
test_b2
,
test_target
],
theano
.
Out
(
output
,
borrow
=
False
))
a
=
numpy
.
zeros
((
1
,
5
))
b
=
numpy
.
ones
(
5
)
c
=
numpy
.
zeros
(
1
,
dtype
=
numpy
.
int32
)
z
=
g
(
a
,
b
,
c
)
z_backup
=
copy
.
copy
(
z
)
id_z
=
id
(
z
)
print
(
'Output z after first call:
%
s'
%
(
z
,
))
a
[
0
,
0
]
=
1
id_other
=
id
(
g
(
a
,
b
,
c
))
print
(
'Output z after second call:
%
s'
%
(
z
,
))
# Ensure that calling the function again returns a pointer towards a new
# array.
assert
id_z
!=
id_other
# Just to be 100% sure, ensure that z was not altered.
assert
(
z
==
z_backup
)
.
all
()
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论