Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
069b58ac
提交
069b58ac
authored
12月 07, 2020
作者:
Michael Osthege
提交者:
Brandon T. Willard
12月 09, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pass kwargs instead of list of tuples to change_flags
上级
f7898c43
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
10 行增加
和
10 行删除
+10
-10
test_abstract_conv.py
tests/tensor/nnet/test_abstract_conv.py
+7
-7
test_nnet.py
tests/tensor/nnet/test_nnet.py
+3
-3
没有找到文件。
tests/tensor/nnet/test_abstract_conv.py
浏览文件 @
069b58ac
...
@@ -295,7 +295,7 @@ class TestAssertConvShape:
...
@@ -295,7 +295,7 @@ class TestAssertConvShape:
class
TestAssertShape
:
class
TestAssertShape
:
@change_flags
(
[(
"conv__assert_shape"
,
True
)]
)
@change_flags
(
conv__assert_shape
=
True
)
def
test_basic
(
self
):
def
test_basic
(
self
):
x
=
tensor
.
tensor4
()
x
=
tensor
.
tensor4
()
s1
=
tensor
.
iscalar
()
s1
=
tensor
.
iscalar
()
...
@@ -318,7 +318,7 @@ class TestAssertShape:
...
@@ -318,7 +318,7 @@ class TestAssertShape:
with
pytest
.
raises
(
AssertionError
):
with
pytest
.
raises
(
AssertionError
):
f
(
v
,
7
,
7
)
f
(
v
,
7
,
7
)
@change_flags
(
[(
"conv__assert_shape"
,
True
)]
)
@change_flags
(
conv__assert_shape
=
True
)
def
test_shape_check_conv2d
(
self
):
def
test_shape_check_conv2d
(
self
):
input
=
tensor
.
tensor4
()
input
=
tensor
.
tensor4
()
filters
=
tensor
.
tensor4
()
filters
=
tensor
.
tensor4
()
...
@@ -340,7 +340,7 @@ class TestAssertShape:
...
@@ -340,7 +340,7 @@ class TestAssertShape:
np
.
zeros
((
7
,
5
,
2
,
2
),
dtype
=
"float32"
),
np
.
zeros
((
7
,
5
,
2
,
2
),
dtype
=
"float32"
),
)
)
@change_flags
(
[(
"conv__assert_shape"
,
True
)]
)
@change_flags
(
conv__assert_shape
=
True
)
@pytest.mark.skipif
(
theano
.
config
.
cxx
==
""
,
reason
=
"test needs cxx"
)
@pytest.mark.skipif
(
theano
.
config
.
cxx
==
""
,
reason
=
"test needs cxx"
)
def
test_shape_check_conv3d
(
self
):
def
test_shape_check_conv3d
(
self
):
input
=
tensor
.
tensor5
()
input
=
tensor
.
tensor5
()
...
@@ -363,7 +363,7 @@ class TestAssertShape:
...
@@ -363,7 +363,7 @@ class TestAssertShape:
np
.
zeros
((
7
,
5
,
2
,
2
,
2
),
dtype
=
"float32"
),
np
.
zeros
((
7
,
5
,
2
,
2
,
2
),
dtype
=
"float32"
),
)
)
@change_flags
(
[(
"conv__assert_shape"
,
True
)]
)
@change_flags
(
conv__assert_shape
=
True
)
def
test_shape_check_conv2d_grad_wrt_inputs
(
self
):
def
test_shape_check_conv2d_grad_wrt_inputs
(
self
):
output_grad
=
tensor
.
tensor4
()
output_grad
=
tensor
.
tensor4
()
filters
=
tensor
.
tensor4
()
filters
=
tensor
.
tensor4
()
...
@@ -382,7 +382,7 @@ class TestAssertShape:
...
@@ -382,7 +382,7 @@ class TestAssertShape:
np
.
zeros
((
7
,
6
,
3
,
3
),
dtype
=
"float32"
),
np
.
zeros
((
7
,
6
,
3
,
3
),
dtype
=
"float32"
),
)
)
@change_flags
(
[(
"conv__assert_shape"
,
True
)]
)
@change_flags
(
conv__assert_shape
=
True
)
@pytest.mark.skipif
(
theano
.
config
.
cxx
==
""
,
reason
=
"test needs cxx"
)
@pytest.mark.skipif
(
theano
.
config
.
cxx
==
""
,
reason
=
"test needs cxx"
)
def
test_shape_check_conv3d_grad_wrt_inputs
(
self
):
def
test_shape_check_conv3d_grad_wrt_inputs
(
self
):
output_grad
=
tensor
.
tensor5
()
output_grad
=
tensor
.
tensor5
()
...
@@ -402,7 +402,7 @@ class TestAssertShape:
...
@@ -402,7 +402,7 @@ class TestAssertShape:
np
.
zeros
((
7
,
6
,
3
,
3
,
3
),
dtype
=
"float32"
),
np
.
zeros
((
7
,
6
,
3
,
3
,
3
),
dtype
=
"float32"
),
)
)
@change_flags
(
[(
"conv__assert_shape"
,
True
)]
)
@change_flags
(
conv__assert_shape
=
True
)
def
test_shape_check_conv2d_grad_wrt_weights
(
self
):
def
test_shape_check_conv2d_grad_wrt_weights
(
self
):
input
=
tensor
.
tensor4
()
input
=
tensor
.
tensor4
()
output_grad
=
tensor
.
tensor4
()
output_grad
=
tensor
.
tensor4
()
...
@@ -421,7 +421,7 @@ class TestAssertShape:
...
@@ -421,7 +421,7 @@ class TestAssertShape:
np
.
zeros
((
3
,
7
,
5
,
9
),
dtype
=
"float32"
),
np
.
zeros
((
3
,
7
,
5
,
9
),
dtype
=
"float32"
),
)
)
@change_flags
(
[(
"conv__assert_shape"
,
True
)]
)
@change_flags
(
conv__assert_shape
=
True
)
@pytest.mark.skipif
(
theano
.
config
.
cxx
==
""
,
reason
=
"test needs cxx"
)
@pytest.mark.skipif
(
theano
.
config
.
cxx
==
""
,
reason
=
"test needs cxx"
)
def
test_shape_check_conv3d_grad_wrt_weights
(
self
):
def
test_shape_check_conv3d_grad_wrt_weights
(
self
):
input
=
tensor
.
tensor5
()
input
=
tensor
.
tensor5
()
...
...
tests/tensor/nnet/test_nnet.py
浏览文件 @
069b58ac
...
@@ -874,7 +874,7 @@ class TestCrossEntropyCategorical1Hot(utt.InferShapeTester):
...
@@ -874,7 +874,7 @@ class TestCrossEntropyCategorical1Hot(utt.InferShapeTester):
assert
crossentropy_softmax_argmax_1hot_with_bias
in
ops
assert
crossentropy_softmax_argmax_1hot_with_bias
in
ops
assert
not
[
1
for
o
in
ops
if
isinstance
(
o
,
tt
.
AdvancedSubtensor
)]
assert
not
[
1
for
o
in
ops
if
isinstance
(
o
,
tt
.
AdvancedSubtensor
)]
with
theano
.
change_flags
(
[(
"warn__sum_div_dimshuffle_bug"
,
False
)]
):
with
theano
.
change_flags
(
warn__sum_div_dimshuffle_bug
=
False
):
fgraph
=
gof
.
FunctionGraph
([
x
,
b
,
y
],
[
tt
.
grad
(
expr
,
x
)])
fgraph
=
gof
.
FunctionGraph
([
x
,
b
,
y
],
[
tt
.
grad
(
expr
,
x
)])
optdb
.
query
(
OPT_FAST_RUN
)
.
optimize
(
fgraph
)
optdb
.
query
(
OPT_FAST_RUN
)
.
optimize
(
fgraph
)
...
@@ -911,7 +911,7 @@ class TestCrossEntropyCategorical1Hot(utt.InferShapeTester):
...
@@ -911,7 +911,7 @@ class TestCrossEntropyCategorical1Hot(utt.InferShapeTester):
assert
crossentropy_softmax_argmax_1hot_with_bias
in
ops
assert
crossentropy_softmax_argmax_1hot_with_bias
in
ops
assert
not
[
1
for
o
in
ops
if
isinstance
(
o
,
tt
.
AdvancedSubtensor
)]
assert
not
[
1
for
o
in
ops
if
isinstance
(
o
,
tt
.
AdvancedSubtensor
)]
with
theano
.
change_flags
(
[(
"warn__sum_div_dimshuffle_bug"
,
False
)]
):
with
theano
.
change_flags
(
warn__sum_div_dimshuffle_bug
=
False
):
fgraph
=
gof
.
FunctionGraph
([
x
,
b
,
y
],
[
tt
.
grad
(
expr
,
x
)])
fgraph
=
gof
.
FunctionGraph
([
x
,
b
,
y
],
[
tt
.
grad
(
expr
,
x
)])
optdb
.
query
(
OPT_FAST_RUN
)
.
optimize
(
fgraph
)
optdb
.
query
(
OPT_FAST_RUN
)
.
optimize
(
fgraph
)
...
@@ -949,7 +949,7 @@ class TestCrossEntropyCategorical1Hot(utt.InferShapeTester):
...
@@ -949,7 +949,7 @@ class TestCrossEntropyCategorical1Hot(utt.InferShapeTester):
assert
crossentropy_softmax_argmax_1hot_with_bias
in
ops
assert
crossentropy_softmax_argmax_1hot_with_bias
in
ops
assert
not
[
1
for
o
in
ops
if
isinstance
(
o
,
tt
.
AdvancedSubtensor
)]
assert
not
[
1
for
o
in
ops
if
isinstance
(
o
,
tt
.
AdvancedSubtensor
)]
with
theano
.
change_flags
(
[(
"warn__sum_div_dimshuffle_bug"
,
False
)]
):
with
theano
.
change_flags
(
warn__sum_div_dimshuffle_bug
=
False
):
fgraph
=
gof
.
FunctionGraph
([
x
,
b
,
y
],
[
tt
.
grad
(
expr
,
x
)])
fgraph
=
gof
.
FunctionGraph
([
x
,
b
,
y
],
[
tt
.
grad
(
expr
,
x
)])
optdb
.
query
(
OPT_FAST_RUN
)
.
optimize
(
fgraph
)
optdb
.
query
(
OPT_FAST_RUN
)
.
optimize
(
fgraph
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论