Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6df163f0
提交
6df163f0
authored
10月 18, 2020
作者:
Brandon T. Willard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace theano.tensor alias T with tt in tests.compile
上级
33667eb7
全部展开
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
21 行增加
和
21 行删除
+21
-21
test_builders.py
tests/compile/test_builders.py
+0
-0
test_function_module.py
tests/compile/test_function_module.py
+0
-0
test_mode.py
tests/compile/test_mode.py
+5
-5
test_modes.py
tests/compile/test_modes.py
+3
-3
test_nanguardmode.py
tests/compile/test_nanguardmode.py
+7
-7
test_profiling.py
tests/compile/test_profiling.py
+6
-6
没有找到文件。
tests/compile/test_builders.py
浏览文件 @
6df163f0
差异被折叠。
点击展开。
tests/compile/test_function_module.py
浏览文件 @
6df163f0
差异被折叠。
点击展开。
tests/compile/test_mode.py
浏览文件 @
6df163f0
import
pytest
import
pytest
import
theano
import
theano
import
theano.tensor
as
T
import
theano.tensor
as
tt
from
theano.compile.mode
import
Mode
,
AddFeatureOptimizer
from
theano.compile.mode
import
Mode
,
AddFeatureOptimizer
from
theano.gof.toolbox
import
NoOutputFromInplace
from
theano.gof.toolbox
import
NoOutputFromInplace
...
@@ -11,10 +11,10 @@ from theano.gof.toolbox import NoOutputFromInplace
...
@@ -11,10 +11,10 @@ from theano.gof.toolbox import NoOutputFromInplace
not
theano
.
config
.
cxx
,
reason
=
"G++ not available, so we need to skip this test."
not
theano
.
config
.
cxx
,
reason
=
"G++ not available, so we need to skip this test."
)
)
def
test_no_output_from_implace
():
def
test_no_output_from_implace
():
x
=
T
.
matrix
()
x
=
tt
.
matrix
()
y
=
T
.
matrix
()
y
=
tt
.
matrix
()
a
=
T
.
dot
(
x
,
y
)
a
=
tt
.
dot
(
x
,
y
)
b
=
T
.
tanh
(
a
)
b
=
tt
.
tanh
(
a
)
# Ensure that the elemwise op that produces the output is inplace when
# Ensure that the elemwise op that produces the output is inplace when
# using a mode that does not include the optimization
# using a mode that does not include the optimization
...
...
tests/compile/test_modes.py
浏览文件 @
6df163f0
...
@@ -5,7 +5,7 @@ Test compilation modes
...
@@ -5,7 +5,7 @@ Test compilation modes
import
copy
import
copy
import
theano
import
theano
import
theano.tensor
as
T
import
theano.tensor
as
tt
from
theano.compile
import
Mode
from
theano.compile
import
Mode
...
@@ -25,8 +25,8 @@ class TestBunchOfModes:
...
@@ -25,8 +25,8 @@ class TestBunchOfModes:
modes
=
predef_modes
+
[
Mode
(
linker
,
"fast_run"
)
for
linker
in
linkers
]
modes
=
predef_modes
+
[
Mode
(
linker
,
"fast_run"
)
for
linker
in
linkers
]
for
mode
in
modes
:
for
mode
in
modes
:
x
=
T
.
matrix
()
x
=
tt
.
matrix
()
y
=
T
.
vector
()
y
=
tt
.
vector
()
f
=
theano
.
function
([
x
,
y
],
x
+
y
,
mode
=
mode
)
f
=
theano
.
function
([
x
,
y
],
x
+
y
,
mode
=
mode
)
# test that it runs something
# test that it runs something
f
([[
1
,
2
],
[
3
,
4
]],
[
5
,
6
])
f
([[
1
,
2
],
[
3
,
4
]],
[
5
,
6
])
...
...
tests/compile/test_nanguardmode.py
浏览文件 @
6df163f0
...
@@ -2,23 +2,23 @@
...
@@ -2,23 +2,23 @@
This test is for testing the NanGuardMode.
This test is for testing the NanGuardMode.
"""
"""
import
logging
import
logging
import
pytest
import
pytest
import
numpy
as
np
import
numpy
as
np
from
theano.compile.nanguardmode
import
NanGuardMode
import
theano
import
theano
import
theano.tensor
as
T
import
theano.tensor
as
tt
from
theano.compile.nanguardmode
import
NanGuardMode
def
test_NanGuardMode
():
def
test_NanGuardMode
():
# Tests if NanGuardMode is working by feeding in numpy.inf and numpy.nans
# Tests if NanGuardMode is working by feeding in numpy.inf and numpy.nans
# intentionally. A working implementation should be able to capture all
# intentionally. A working implementation should be able to capture all
# the abnormalties.
# the abnormalties.
x
=
T
.
matrix
()
x
=
tt
.
matrix
()
w
=
theano
.
shared
(
np
.
random
.
randn
(
5
,
7
)
.
astype
(
theano
.
config
.
floatX
))
w
=
theano
.
shared
(
np
.
random
.
randn
(
5
,
7
)
.
astype
(
theano
.
config
.
floatX
))
y
=
T
.
dot
(
x
,
w
)
y
=
tt
.
dot
(
x
,
w
)
fun
=
theano
.
function
(
fun
=
theano
.
function
(
[
x
],
y
,
mode
=
NanGuardMode
(
nan_is_error
=
True
,
inf_is_error
=
True
)
[
x
],
y
,
mode
=
NanGuardMode
(
nan_is_error
=
True
,
inf_is_error
=
True
)
...
@@ -51,8 +51,8 @@ def test_NanGuardMode():
...
@@ -51,8 +51,8 @@ def test_NanGuardMode():
nana
=
np
.
tile
(
np
.
asarray
(
np
.
nan
)
.
astype
(
theano
.
config
.
floatX
),
(
3
,
4
,
5
))
nana
=
np
.
tile
(
np
.
asarray
(
np
.
nan
)
.
astype
(
theano
.
config
.
floatX
),
(
3
,
4
,
5
))
biga
=
np
.
tile
(
np
.
asarray
(
1e20
)
.
astype
(
theano
.
config
.
floatX
),
(
3
,
4
,
5
))
biga
=
np
.
tile
(
np
.
asarray
(
1e20
)
.
astype
(
theano
.
config
.
floatX
),
(
3
,
4
,
5
))
x
=
T
.
tensor3
()
x
=
tt
.
tensor3
()
y
=
x
[:,
T
.
arange
(
2
),
T
.
arange
(
2
),
None
]
y
=
x
[:,
tt
.
arange
(
2
),
tt
.
arange
(
2
),
None
]
fun
=
theano
.
function
(
fun
=
theano
.
function
(
[
x
],
y
,
mode
=
NanGuardMode
(
nan_is_error
=
True
,
inf_is_error
=
True
)
[
x
],
y
,
mode
=
NanGuardMode
(
nan_is_error
=
True
,
inf_is_error
=
True
)
)
)
...
...
tests/compile/test_profiling.py
浏览文件 @
6df163f0
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
import
numpy
as
np
import
numpy
as
np
import
theano
import
theano
import
theano.tensor
as
T
import
theano.tensor
as
tt
from
six.moves
import
StringIO
from
six.moves
import
StringIO
from
theano.ifelse
import
ifelse
from
theano.ifelse
import
ifelse
...
@@ -23,10 +23,10 @@ class TestProfiling:
...
@@ -23,10 +23,10 @@ class TestProfiling:
theano
.
config
.
profile_memory
=
True
theano
.
config
.
profile_memory
=
True
theano
.
config
.
profiling
.
min_peak_memory
=
True
theano
.
config
.
profiling
.
min_peak_memory
=
True
x
=
[
T
.
fvector
(
"val
%
i"
%
i
)
for
i
in
range
(
3
)]
x
=
[
tt
.
fvector
(
"val
%
i"
%
i
)
for
i
in
range
(
3
)]
z
=
[]
z
=
[]
z
+=
[
T
.
outer
(
x
[
i
],
x
[
i
+
1
])
.
sum
(
axis
=
1
)
for
i
in
range
(
len
(
x
)
-
1
)]
z
+=
[
tt
.
outer
(
x
[
i
],
x
[
i
+
1
])
.
sum
(
axis
=
1
)
for
i
in
range
(
len
(
x
)
-
1
)]
z
+=
[
x
[
i
]
+
x
[
i
+
1
]
for
i
in
range
(
len
(
x
)
-
1
)]
z
+=
[
x
[
i
]
+
x
[
i
+
1
]
for
i
in
range
(
len
(
x
)
-
1
)]
p
=
theano
.
ProfileStats
(
False
,
gpu_checks
=
False
)
p
=
theano
.
ProfileStats
(
False
,
gpu_checks
=
False
)
...
@@ -79,10 +79,10 @@ class TestProfiling:
...
@@ -79,10 +79,10 @@ class TestProfiling:
theano
.
config
.
profile
=
True
theano
.
config
.
profile
=
True
theano
.
config
.
profile_memory
=
True
theano
.
config
.
profile_memory
=
True
a
,
b
=
T
.
scalars
(
"a"
,
"b"
)
a
,
b
=
tt
.
scalars
(
"a"
,
"b"
)
x
,
y
=
T
.
scalars
(
"x"
,
"y"
)
x
,
y
=
tt
.
scalars
(
"x"
,
"y"
)
z
=
ifelse
(
T
.
lt
(
a
,
b
),
x
*
2
,
y
*
2
)
z
=
ifelse
(
tt
.
lt
(
a
,
b
),
x
*
2
,
y
*
2
)
p
=
theano
.
ProfileStats
(
False
,
gpu_checks
=
False
)
p
=
theano
.
ProfileStats
(
False
,
gpu_checks
=
False
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论