Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
64096a4a
提交
64096a4a
authored
10月 21, 2020
作者:
Brandon T. Willard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Apply pyupgrade to tests.scan_module
上级
ba16d2d6
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
7 行增加
和
7 行删除
+7
-7
test_scan.py
tests/scan_module/test_scan.py
+3
-3
test_scan_opt.py
tests/scan_module/test_scan_opt.py
+4
-4
没有找到文件。
tests/scan_module/test_scan.py
浏览文件 @
64096a4a
...
...
@@ -742,7 +742,7 @@ class TestScan:
# Call verify_grad to ensure the correctness of the second gradients
floatX
=
theano
.
config
.
floatX
inputs_test_values
=
[
np
.
random
.
random
(
(
3
)
)
.
astype
(
floatX
)]
inputs_test_values
=
[
np
.
random
.
random
(
3
)
.
astype
(
floatX
)]
utt
.
verify_grad
(
get_sum_of_grad
,
inputs_test_values
)
def
test_verify_second_grad_mitsot1
(
self
):
...
...
@@ -771,7 +771,7 @@ class TestScan:
floatX
=
theano
.
config
.
floatX
inputs_test_values
=
[
np
.
random
.
random
((
2
,
3
))
.
astype
(
floatX
),
np
.
random
.
random
(
(
3
)
)
.
astype
(
floatX
),
np
.
random
.
random
(
3
)
.
astype
(
floatX
),
]
utt
.
verify_grad
(
get_sum_of_grad
,
inputs_test_values
)
...
...
@@ -3896,7 +3896,7 @@ for{cpu,scan_fn}.2 [id H] ''
dtype
=
theano
.
config
.
floatX
seq_value
=
np
.
random
.
random
((
10
,
3
))
.
astype
(
dtype
)
out_init_value
=
np
.
random
.
random
((
3
,
3
))
.
astype
(
dtype
)
non_seq_value
=
np
.
random
.
random
(
(
3
)
)
.
astype
(
dtype
)
non_seq_value
=
np
.
random
.
random
(
3
)
.
astype
(
dtype
)
outputs
=
fct
(
seq_value
,
out_init_value
,
non_seq_value
)
...
...
tests/scan_module/test_scan_opt.py
浏览文件 @
64096a4a
...
...
@@ -89,7 +89,7 @@ class TestGaussNewton:
# during certain iterations of CG in the HF algorithm. There,
# it's in fact `pi + current update proposal`. For simplicity,
# I just multiply by 2 here.
cost_
=
theano
.
clone
(
cost
,
replace
=
dict
([(
pi
,
2
*
pi
)
for
pi
in
params
])
)
cost_
=
theano
.
clone
(
cost
,
replace
=
{
pi
:
2
*
pi
for
pi
in
params
}
)
# Compute Gauss-Newton-Matrix times some vector `v` which is `p` in CG,
# but for simplicity, I just take the parameters vector because it's
...
...
@@ -112,7 +112,7 @@ class TestGaussNewton:
self
.
_run
(
100
,
10
,
batch_size
=
1
,
mode
=
mode
)
class
GaussNewtonMatrix
(
object
)
:
class
GaussNewtonMatrix
:
def
__init__
(
self
,
s
):
# `s` is the linear network outputs, i.e. the network output
# without having applied the activation function
...
...
@@ -131,7 +131,7 @@ class GaussNewtonMatrix(object):
return
JHJv
class
TestPushOutScanOutputDot
(
object
)
:
class
TestPushOutScanOutputDot
:
"""
Test class for the PushOutScanOutput optimizer in the case where the inner
function of a scan op has an output which is the result of a Dot product
...
...
@@ -166,7 +166,7 @@ class TestPushOutScanOutputDot(object):
# Ensure that the function compiled with the optimization produces
# the same results as the function compiled without
v_value
=
np
.
random
.
random
(
(
4
)
)
.
astype
(
config
.
floatX
)
v_value
=
np
.
random
.
random
(
4
)
.
astype
(
config
.
floatX
)
m_value
=
np
.
random
.
random
((
4
,
5
))
.
astype
(
config
.
floatX
)
output_opt
=
f_opt
(
v_value
,
m_value
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论