Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b4fbaa2e
提交
b4fbaa2e
authored
10月 21, 2020
作者:
Brandon T. Willard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Apply isort to tests.gof sub-package modules
上级
ed04fa8a
显示空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
69 行增加
和
98 行删除
+69
-98
test_cc.py
tests/gof/test_cc.py
+5
-6
test_compute_test_value.py
tests/gof/test_compute_test_value.py
+4
-19
test_destroyhandler.py
tests/gof/test_destroyhandler.py
+10
-14
test_graph.py
tests/gof/test_graph.py
+5
-7
test_graph_opt_caching.py
tests/gof/test_graph_opt_caching.py
+3
-0
test_lazy.py
tests/gof/test_lazy.py
+3
-5
test_link.py
tests/gof/test_link.py
+6
-8
test_op.py
tests/gof/test_op.py
+5
-5
test_opt.py
tests/gof/test_opt.py
+9
-10
test_optdb.py
tests/gof/test_optdb.py
+1
-1
test_params_type.py
tests/gof/test_params_type.py
+4
-6
test_sched.py
tests/gof/test_sched.py
+6
-7
test_toolbox.py
tests/gof/test_toolbox.py
+3
-4
test_types.py
tests/gof/test_types.py
+3
-2
test_vm.py
tests/gof/test_vm.py
+2
-4
没有找到文件。
tests/gof/test_cc.py
浏览文件 @
b4fbaa2e
import
pytest
import
numpy
as
np
import
pytest
import
theano
from
theano.gof
.link
import
PerformLinker
from
theano.gof
import
fg
from
theano.gof.cc
import
CLinker
,
DualLinker
,
OpWiseCLinker
from
theano.gof.
type
import
Typ
e
from
theano.gof.
graph
import
Variable
,
Apply
,
Constant
from
theano.gof.
graph
import
Apply
,
Constant
,
Variabl
e
from
theano.gof.
link
import
PerformLinker
from
theano.gof.op
import
Op
from
theano.gof
import
fg
from
theano.gof
.type
import
Type
def
as_variable
(
x
):
...
...
tests/gof/test_compute_test_value.py
浏览文件 @
b4fbaa2e
import
os
import
sys
import
traceback
import
warnings
import
pytest
import
numpy
as
np
import
pytest
import
theano
import
theano.tensor
as
tt
from
theano
import
config
,
scalar
from
theano.gof
import
Apply
,
Op
,
utils
from
theano.tensor.basic
import
_allclose
...
...
@@ -222,21 +218,12 @@ class TestComputeTestValue:
def
fx
(
prior_result
,
A
):
return
tt
.
dot
(
prior_result
,
A
)
# Since we have to inspect the traceback,
# we cannot simply use self.assertRaises()
with
pytest
.
raises
(
ValueError
):
with
pytest
.
raises
(
ValueError
)
as
e
:
theano
.
scan
(
fn
=
fx
,
outputs_info
=
tt
.
ones_like
(
A
),
non_sequences
=
A
,
n_steps
=
k
)
# Get traceback
tb
=
sys
.
exc_info
()[
2
]
frame_infos
=
traceback
.
extract_tb
(
tb
)
assert
str
(
e
.
traceback
[
0
]
.
path
)
.
endswith
(
"test_compute_test_value.py"
)
# We should be in the "fx" function defined above
expected
=
"test_compute_test_value.py"
assert
any
(
(
os
.
path
.
split
(
frame_info
[
0
])[
1
]
==
expected
and
frame_info
[
2
]
==
"fx"
)
for
frame_info
in
frame_infos
),
frame_infos
assert
e
.
traceback
[
2
]
.
name
==
"fx"
@theano.change_flags
(
compute_test_value
=
"raise"
)
def
test_scan_err2
(
self
):
...
...
@@ -255,8 +242,6 @@ class TestComputeTestValue:
fn
=
fx
,
outputs_info
=
tt
.
ones_like
(
A
.
T
),
non_sequences
=
A
,
n_steps
=
k
)
# Since we have to inspect the traceback,
# we cannot simply use self.assertRaises()
with
pytest
.
raises
(
ValueError
,
match
=
"^could not broadcast input"
):
theano
.
scan
(
fn
=
fx
,
outputs_info
=
tt
.
ones_like
(
A
.
T
),
non_sequences
=
A
,
n_steps
=
k
...
...
tests/gof/test_destroyhandler.py
浏览文件 @
b4fbaa2e
import
pytest
from
copy
import
copy
from
theano.gof.type
import
Type
from
theano.gof
import
graph
from
theano.gof.graph
import
Variable
,
Apply
import
pytest
from
tests.unittest_tools
import
assertFailure_fast
from
theano
import
change_flags
from
theano.gof
import
destroyhandler
,
graph
from
theano.gof.fg
import
FunctionGraph
,
InconsistencyError
from
theano.gof.graph
import
Apply
,
Variable
from
theano.gof.op
import
Op
from
theano.gof.opt
import
(
NavigatorOptimizer
,
OpKeyOptimizer
,
OpSub
,
PatternSub
,
NavigatorOptimizer
,
TopoOptimizer
,
OpSub
,
)
from
theano
import
change_flags
from
theano.gof
import
destroyhandler
from
theano.gof.fg
import
FunctionGraph
,
InconsistencyError
from
theano.gof.toolbox
import
ReplaceValidate
from
tests.unittest_tools
import
assertFailure_fast
from
theano.gof.type
import
Type
def
PatternOptimizer
(
p1
,
p2
,
ign
=
True
):
...
...
tests/gof/test_graph.py
浏览文件 @
b4fbaa2e
import
pickle
import
pytest
from
itertools
import
count
import
numpy
as
np
import
pytest
from
itertools
import
count
from
theano
import
sparse
,
shared
,
tensor
from
theano
import
shared
,
sparse
,
tensor
from
theano.gof.graph
import
(
Apply
,
Variable
,
as_string
,
clone
,
equal_computations
,
general_toposort
,
inputs
,
io_toposort
,
Variable
,
equal_computations
,
)
from
theano.gof.op
import
Op
from
theano.gof.type
import
Type
...
...
tests/gof/test_graph_opt_caching.py
浏览文件 @
b4fbaa2e
import
os
import
numpy
as
np
import
theano
import
theano.tensor
as
tt
floatX
=
"float32"
...
...
tests/gof/test_lazy.py
浏览文件 @
b4fbaa2e
import
pytest
from
copy
import
deepcopy
import
numpy
as
np
import
pytest
import
theano
import
theano.tensor
as
tt
from
copy
import
deepcopy
from
theano
import
function
,
Mode
from
theano
import
Mode
,
function
from
theano.gof
import
Apply
,
generic
from
theano.gof.op
import
PureOp
from
theano.ifelse
import
ifelse
...
...
tests/gof/test_link.py
浏览文件 @
b4fbaa2e
...
...
@@ -3,14 +3,12 @@ from copy import deepcopy
import
numpy
as
np
import
theano
from
theano.gof
import
graph
from
theano.gof.graph
import
Variable
,
Apply
,
Constant
from
theano.gof.type
import
Type
from
theano.gof.op
import
Op
from
theano.gof
import
fg
from
theano.gof.link
import
PerformLinker
,
WrapLinker
,
Container
from
theano.compat
import
cmp
from
theano.gof
import
fg
,
graph
from
theano.gof.graph
import
Apply
,
Constant
,
Variable
from
theano.gof.link
import
Container
,
PerformLinker
,
WrapLinker
from
theano.gof.op
import
Op
from
theano.gof.type
import
Type
def
as_variable
(
x
):
...
...
@@ -175,7 +173,7 @@ class TestWrapLinker:
def
test_sort_schedule_fn
():
import
theano
from
theano.gof.sched
import
sort_schedule_fn
,
make_depends
from
theano.gof.sched
import
make_depends
,
sort_schedule_fn
x
=
theano
.
tensor
.
matrix
(
"x"
)
y
=
theano
.
tensor
.
dot
(
x
[:
5
]
*
2
,
x
.
T
+
1
)
.
T
...
...
tests/gof/test_op.py
浏览文件 @
b4fbaa2e
import
numpy
as
np
import
pytest
from
six
import
string_types
import
theano
import
theano.gof.op
as
op
import
theano.tensor
as
tt
from
six
import
string_types
from
theano
import
scalar
,
shared
,
config
from
theano
import
config
,
scalar
,
shared
from
theano.configparser
import
change_flags
from
theano.gof.graph
import
Apply
,
Variable
from
theano.gof.type
import
Generic
,
Type
from
theano.gof.op
import
Op
from
theano.gof.utils
import
TestValueError
,
MethodNotDefined
from
theano.gof.type
import
Generic
,
Type
from
theano.gof.utils
import
MethodNotDefined
,
TestValueError
def
as_variable
(
x
):
...
...
tests/gof/test_opt.py
浏览文件 @
b4fbaa2e
import
theano.tensor
as
tt
from
theano.gof.type
import
Type
from
theano.gof.graph
import
Variable
,
Apply
,
Constant
from
theano.gof.fg
import
FunctionGraph
from
theano.gof.graph
import
Apply
,
Constant
,
Variable
from
theano.gof.op
import
Op
from
theano.gof.opt
import
(
EquilibriumOptimizer
,
MergeOptimizer
,
OpKeyOptimizer
,
OpSub
,
PatternSub
,
TopoOptimizer
,
OpSub
,
MergeOptimizer
,
config
,
theano
,
EquilibriumOptimizer
,
logging
,
pre_constant_merge
,
pre_greedy_local_optimizer
,
theano
,
)
from
theano.gof.fg
import
FunctionGraph
from
theano.tensor.type_other
import
MakeSlice
,
SliceConstant
,
slicetype
from
theano.tensor.subtensor
import
AdvancedSubtensor
from
theano.gof.type
import
Type
from
theano.tensor.opt
import
constant_folding
from
theano.tensor.subtensor
import
AdvancedSubtensor
from
theano.tensor.type_other
import
MakeSlice
,
SliceConstant
,
slicetype
def
is_variable
(
x
):
...
...
tests/gof/test_optdb.py
浏览文件 @
b4fbaa2e
import
pytest
from
theano.gof.optdb
import
opt
,
DB
from
theano.gof.optdb
import
DB
,
opt
class
TestDB
:
...
...
tests/gof/test_params_type.py
浏览文件 @
b4fbaa2e
import
pytest
import
numpy
as
np
import
pytest
import
theano
from
theano
import
tensor
,
Generic
from
tests
import
unittest_tools
as
utt
from
theano
import
Generic
,
tensor
from
theano.gof
import
Apply
,
COp
,
EnumList
,
Op
,
Params
,
ParamsType
from
theano.scalar
import
Scalar
from
theano.tensor
import
TensorType
from
theano.gof
import
ParamsType
,
Params
,
EnumList
,
Op
,
COp
,
Apply
from
tests
import
unittest_tools
as
utt
tensor_type_0d
=
TensorType
(
"float64"
,
tuple
())
scalar_type
=
Scalar
(
"float64"
)
...
...
tests/gof/test_sched.py
浏览文件 @
b4fbaa2e
from
theano
import
tensor
from
theano.compat
import
cmp
from
theano.gof.graph
import
io_toposort
from
theano.gof.sched
import
(
make_dependence_cmp
,
sort_apply_nodes
,
reverse_dict
,
_toposort
,
make_dependence_cmp
,
posort
,
reverse_dict
,
sort_apply_nodes
,
)
from
theano
import
tensor
from
theano.gof.graph
import
io_toposort
from
theano.compat
import
cmp
def
test_dependence
():
dependence
=
make_dependence_cmp
()
...
...
tests/gof/test_toolbox.py
浏览文件 @
b4fbaa2e
from
theano
import
tensor
from
theano.gof.graph
import
Variable
,
Apply
from
theano.gof.type
import
Type
from
theano.gof.op
import
Op
from
theano.gof.fg
import
FunctionGraph
from
theano.gof.graph
import
Apply
,
Variable
from
theano.gof.op
import
Op
from
theano.gof.toolbox
import
NodeFinder
,
is_same_graph
from
theano.gof.type
import
Type
class
TestNodeFinder
:
...
...
tests/gof/test_types.py
浏览文件 @
b4fbaa2e
import
os
import
numpy
as
np
import
pytest
import
theano
from
theano
import
Op
,
Apply
,
scalar
from
theano
import
Apply
,
Op
,
scalar
from
theano.gof.type
import
CDataType
,
CEnumType
,
EnumList
,
EnumType
from
theano.tensor
import
TensorType
from
theano.gof.type
import
CDataType
,
EnumType
,
EnumList
,
CEnumType
# todo: test generic
...
...
tests/gof/test_vm.py
浏览文件 @
b4fbaa2e
...
...
@@ -2,15 +2,13 @@ import gc
import
sys
import
time
import
pytest
import
numpy
as
np
import
pytest
import
theano
from
theano
import
function
,
tensor
from
theano.gof
import
vm
,
OpWiseCLinker
from
theano.compile
import
Mode
from
theano.gof
import
OpWiseCLinker
,
vm
from
theano.ifelse
import
ifelse
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论