Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a78a9a80
提交
a78a9a80
authored
4月 10, 2015
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pep8
上级
36152c6c
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
8 行增加
和
21 行删除
+8
-21
test_vm.py
theano/gof/tests/test_vm.py
+8
-20
test_flake8.py
theano/tests/test_flake8.py
+0
-1
没有找到文件。
theano/gof/tests/test_vm.py
浏览文件 @
a78a9a80
...
@@ -2,17 +2,12 @@ import gc
...
@@ -2,17 +2,12 @@ import gc
import
sys
import
sys
import
time
import
time
import
unittest
import
unittest
try
:
import
line_profiler
except
ImportError
:
pass
from
nose.plugins.skip
import
SkipTest
from
nose.plugins.skip
import
SkipTest
import
numpy
import
numpy
from
theano
import
function
from
theano
import
function
from
theano.gof
import
vm
from
theano.gof
import
vm
from
theano.gof
import
link
from
theano.gof
import
OpWiseCLinker
from
theano.gof
import
OpWiseCLinker
from
theano.compile
import
Mode
from
theano.compile
import
Mode
...
@@ -43,7 +38,8 @@ class TestCallbacks(unittest.TestCase):
...
@@ -43,7 +38,8 @@ class TestCallbacks(unittest.TestCase):
f
(
1
,
2
,
3
)
f
(
1
,
2
,
3
)
assert
sum
(
self
.
n_callbacks
.
values
())
==
len
(
f
.
maker
.
fgraph
.
toposort
())
assert
sum
(
self
.
n_callbacks
.
values
())
==
len
(
f
.
maker
.
fgraph
.
toposort
())
f
(
1
,
2
,
3
)
f
(
1
,
2
,
3
)
assert
sum
(
self
.
n_callbacks
.
values
())
==
len
(
f
.
maker
.
fgraph
.
toposort
())
*
2
assert
(
sum
(
self
.
n_callbacks
.
values
())
==
len
(
f
.
maker
.
fgraph
.
toposort
())
*
2
)
def
test_callback_with_ifelse
(
self
):
def
test_callback_with_ifelse
(
self
):
a
,
b
,
c
=
tensor
.
scalars
(
'abc'
)
a
,
b
,
c
=
tensor
.
scalars
(
'abc'
)
...
@@ -99,13 +95,9 @@ def test_speed():
...
@@ -99,13 +95,9 @@ def test_speed():
b
=
build_graph
(
x
,
steps_b
)
b
=
build_graph
(
x
,
steps_b
)
f_a
=
function
([
x
],
a
,
f_a
=
function
([
x
],
a
,
mode
=
Mode
(
optimizer
=
None
,
linker
=
linker
()),
mode
=
Mode
(
optimizer
=
None
,
linker
=
linker
()))
#profile='f_a speed test %s'%name,
)
f_b
=
function
([
x
],
b
,
f_b
=
function
([
x
],
b
,
mode
=
Mode
(
optimizer
=
None
,
linker
=
linker
()),
mode
=
Mode
(
optimizer
=
None
,
linker
=
linker
()))
#profile='f_b speed test %s'%name,
)
f_a
([
2.0
,
3.0
])
f_a
([
2.0
,
3.0
])
t0
=
time
.
time
()
t0
=
time
.
time
()
...
@@ -151,14 +143,10 @@ def test_speed_lazy():
...
@@ -151,14 +143,10 @@ def test_speed_lazy():
f_a
=
function
([
x
],
a
,
f_a
=
function
([
x
],
a
,
mode
=
Mode
(
optimizer
=
None
,
mode
=
Mode
(
optimizer
=
None
,
linker
=
linker
()),
linker
=
linker
()))
#profile='f_a lazy ifelse %s'%name,
)
f_b
=
function
([
x
],
b
,
f_b
=
function
([
x
],
b
,
mode
=
Mode
(
optimizer
=
None
,
mode
=
Mode
(
optimizer
=
None
,
linker
=
linker
()),
linker
=
linker
()))
#profile='f_b lazy ifelse %s'%name,
)
f_a
([
2.0
])
f_a
([
2.0
])
t0
=
time
.
time
()
t0
=
time
.
time
()
...
@@ -218,7 +206,7 @@ if run_memory_usage_tests:
...
@@ -218,7 +206,7 @@ if run_memory_usage_tests:
for
i
in
xrange
(
1000000
):
for
i
in
xrange
(
1000000
):
n
=
numpy
.
asarray
([
2.3
,
4.5
],
dtype
=
'f'
)
n
=
numpy
.
asarray
([
2.3
,
4.5
],
dtype
=
'f'
)
c
=
sys
.
getrefcount
(
n
)
c
=
sys
.
getrefcount
(
n
)
a
=
cuda
.
CudaNdarray
(
n
)
cuda
.
CudaNdarray
(
n
)
assert
c
==
sys
.
getrefcount
(
n
)
assert
c
==
sys
.
getrefcount
(
n
)
if
not
i
%
1000
:
if
not
i
%
1000
:
print
'.'
,
print
'.'
,
...
@@ -258,7 +246,7 @@ if run_memory_usage_tests:
...
@@ -258,7 +246,7 @@ if run_memory_usage_tests:
def
build_graph
(
x
,
depth
=
5
):
def
build_graph
(
x
,
depth
=
5
):
z
=
x
z
=
x
for
d
in
range
(
depth
):
for
d
in
range
(
depth
):
z
=
ifelse
(
z
.
mean
()
>
0.5
,
-
z
,
z
)
z
=
ifelse
(
z
.
mean
()
>
0.5
,
-
z
,
z
)
return
z
return
z
def
time_linker
(
name
,
linker
):
def
time_linker
(
name
,
linker
):
...
...
theano/tests/test_flake8.py
浏览文件 @
a78a9a80
...
@@ -320,7 +320,6 @@ whitelist_flake8 = [
...
@@ -320,7 +320,6 @@ whitelist_flake8 = [
"gof/tests/test_destroyhandler.py"
,
"gof/tests/test_destroyhandler.py"
,
"gof/tests/test_opt.py"
,
"gof/tests/test_opt.py"
,
"gof/tests/test_lazy.py"
,
"gof/tests/test_lazy.py"
,
"gof/tests/test_vm.py"
,
"gof/tests/test_toolbox.py"
,
"gof/tests/test_toolbox.py"
,
"gof/tests/test_link.py"
,
"gof/tests/test_link.py"
,
"gof/tests/test_fg.py"
,
"gof/tests/test_fg.py"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论