Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
3800f5cf
提交
3800f5cf
authored
5月 07, 2022
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
5月 08, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add missing DeprecationWarnings and catch them in tests
上级
88d68ac4
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
134 行增加
和
96 行删除
+134
-96
rng_mrg.py
aesara/sandbox/rng_mrg.py
+5
-3
conv.py
aesara/tensor/nnet/conv.py
+3
-1
test_multinomial_wo_replacement.py
tests/sandbox/test_multinomial_wo_replacement.py
+4
-2
test_conv.py
tests/tensor/nnet/test_conv.py
+122
-90
没有找到文件。
aesara/sandbox/rng_mrg.py
浏览文件 @
3800f5cf
...
...
@@ -692,9 +692,10 @@ def guess_n_streams(size, warn=False):
if
warn
:
warnings
.
warn
(
(
"MRG_RandomStream
Can't determine #
streams "
"MRG_RandomStream
can't determine the number of
streams "
f
"from size ({size}), guessing 60*256"
),
DeprecationWarning
,
stacklevel
=
3
,
)
return
60
*
256
...
...
@@ -1106,9 +1107,10 @@ class MRG_RandomStream:
**
kwargs
,
):
warnings
.
warn
(
"MRG_RandomStream.multinomial_wo_replacement
()
is "
"MRG_RandomStream.multinomial_wo_replacement is "
"deprecated and will be removed in the next release of "
"Aesara. Please use MRG_RandomStream.choice() instead."
"Aesara. Please use MRG_RandomStream.choice instead."
,
DeprecationWarning
,
)
assert
size
is
None
return
self
.
choice
(
...
...
aesara/tensor/nnet/conv.py
浏览文件 @
3800f5cf
...
...
@@ -107,7 +107,8 @@ def conv2d(
warnings
.
warn
(
"aesara.tensor.nnet.conv.conv2d is deprecated."
" Use aesara.tensor.nnet.conv2d instead."
" Use aesara.tensor.nnet.conv2d instead."
,
DeprecationWarning
,
)
# accept Constant value for image_shape and filter_shape.
...
...
@@ -406,6 +407,7 @@ class ConvOp(OpenMPOp):
warnings
.
warn
(
"The method `getOutputShape` is deprecated use"
"`get_conv_output_shape` instead."
,
DeprecationWarning
,
stacklevel
=
2
,
)
return
tuple
(
...
...
tests/sandbox/test_multinomial_wo_replacement.py
浏览文件 @
3800f5cf
...
...
@@ -152,7 +152,8 @@ class TestFunction:
p
=
fmatrix
()
n
=
iscalar
()
m
=
th_rng
.
multinomial_wo_replacement
(
pvals
=
p
,
n
=
n
)
with
pytest
.
warns
(
DeprecationWarning
):
m
=
th_rng
.
multinomial_wo_replacement
(
pvals
=
p
,
n
=
n
)
f
=
function
([
p
,
n
],
m
,
allow_input_downcast
=
True
)
...
...
@@ -175,7 +176,8 @@ class TestFunction:
p
=
fmatrix
()
n
=
iscalar
()
m
=
th_rng
.
multinomial_wo_replacement
(
pvals
=
p
,
n
=
n
)
with
pytest
.
warns
(
DeprecationWarning
):
m
=
th_rng
.
multinomial_wo_replacement
(
pvals
=
p
,
n
=
n
)
f
=
function
([
p
,
n
],
m
,
allow_input_downcast
=
True
)
...
...
tests/tensor/nnet/test_conv.py
浏览文件 @
3800f5cf
...
...
@@ -85,17 +85,18 @@ class TestConv2D(utt.InferShapeTester):
# define aesara graph and function
input
.
name
=
"input"
filters
.
name
=
"filters"
rval
=
conv
.
conv2d
(
input
,
filters
,
image_shape
,
filter_shape
,
border_mode
,
subsample
,
unroll_batch
=
unroll_batch
,
unroll_kern
=
unroll_kern
,
unroll_patch
=
unroll_patch
,
)
with
pytest
.
warns
(
DeprecationWarning
):
rval
=
conv
.
conv2d
(
input
,
filters
,
image_shape
,
filter_shape
,
border_mode
,
subsample
,
unroll_batch
=
unroll_batch
,
unroll_kern
=
unroll_kern
,
unroll_patch
=
unroll_patch
,
)
rval
.
name
=
"conv_output"
return
rval
...
...
@@ -600,15 +601,16 @@ class TestConv2D(utt.InferShapeTester):
input
=
aesara
.
shared
(
np
.
random
.
random
(
image_shape
))
filters
=
aesara
.
shared
(
np
.
random
.
random
(
filter_shape
))
output
=
self
.
conv2d
(
input
,
filters
,
image_shape
,
filter_shape
,
border_mode
,
unroll_patch
=
True
,
openmp
=
openmp
,
)
with
pytest
.
warns
(
DeprecationWarning
):
output
=
conv
.
conv2d
(
input
,
filters
,
image_shape
,
filter_shape
,
border_mode
,
unroll_patch
=
True
,
openmp
=
openmp
,
)
mode
=
Mode
(
linker
=
aesara
.
link
.
vm
.
VMLinker
(
allow_gc
=
False
,
use_cloop
=
True
...
...
@@ -635,101 +637,131 @@ class TestConv2D(utt.InferShapeTester):
bivec_val
=
[
7
,
5
,
3
,
2
]
adtens_val
=
rand
(
*
aivec_val
)
bdtens_val
=
rand
(
*
bivec_val
)
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"valid"
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
with
pytest
.
warns
(
DeprecationWarning
):
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"valid"
)
],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"full"
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
with
pytest
.
warns
(
DeprecationWarning
):
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"full"
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
aivec_val
=
[
6
,
2
,
8
,
3
]
bivec_val
=
[
4
,
2
,
5
,
3
]
adtens_val
=
rand
(
*
aivec_val
)
bdtens_val
=
rand
(
*
bivec_val
)
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"valid"
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
with
pytest
.
warns
(
DeprecationWarning
):
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"valid"
)
],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"full"
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
with
pytest
.
warns
(
DeprecationWarning
):
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"full"
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
aivec_val
=
[
3
,
6
,
7
,
5
]
bivec_val
=
[
5
,
6
,
3
,
2
]
adtens_val
=
rand
(
*
aivec_val
)
bdtens_val
=
rand
(
*
bivec_val
)
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"valid"
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
with
pytest
.
warns
(
DeprecationWarning
):
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"valid"
)
],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"full"
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
with
pytest
.
warns
(
DeprecationWarning
):
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"full"
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
aivec_val
=
[
3
,
6
,
7
,
5
]
bivec_val
=
[
5
,
6
,
2
,
3
]
adtens_val
=
rand
(
*
aivec_val
)
bdtens_val
=
rand
(
*
bivec_val
)
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"valid"
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
with
pytest
.
warns
(
DeprecationWarning
):
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"valid"
)
],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"full"
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
with
pytest
.
warns
(
DeprecationWarning
):
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"full"
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
aivec_val
=
[
5
,
2
,
4
,
3
]
bivec_val
=
[
6
,
2
,
4
,
3
]
adtens_val
=
rand
(
*
aivec_val
)
bdtens_val
=
rand
(
*
bivec_val
)
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"valid"
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
with
pytest
.
warns
(
DeprecationWarning
):
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"valid"
)
],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
self
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"full"
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
with
pytest
.
warns
(
DeprecationWarning
):
self
.
_compile_and_check
(
[
adtens
,
bdtens
],
[
conv
.
conv2d
(
adtens
,
bdtens
,
aivec_val
,
bivec_val
,
border_mode
=
"full"
)],
[
adtens_val
,
bdtens_val
],
conv
.
ConvOp
,
excluding
=
[
"conv_gemm"
],
)
# Test that broadcasting of gradients works correctly when using the
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论