Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
3cfdc345
提交
3cfdc345
authored
3月 04, 2017
作者:
Frédéric Bastien
提交者:
GitHub
3月 04, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5646 from abergeron/fix_daily
Fix problems in daily buildbot (debug mode)
上级
9266fb0e
e3b56388
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
38 行增加
和
66 行删除
+38
-66
test_scan.py
theano/scan_module/tests/test_scan.py
+10
-10
test_nlinalg.py
theano/tensor/tests/test_nlinalg.py
+16
-37
test_slinalg.py
theano/tensor/tests/test_slinalg.py
+12
-19
没有找到文件。
theano/scan_module/tests/test_scan.py
浏览文件 @
3cfdc345
...
...
@@ -1838,20 +1838,20 @@ class T_Scan(unittest.TestCase):
n_in
=
1
n_out
=
1
W_hh_v
=
asarrayX
(
rng
.
uniform
(
size
=
(
n_hid
,
n_hid
),
low
=-
.
01
,
high
=.
0
1
))
h0_v
=
asarrayX
(
rng
.
uniform
(
size
=
(
2
,
n_hid
),
low
=-
.
01
,
high
=.
0
1
))
W_hh_v
=
asarrayX
(
rng
.
uniform
(
size
=
(
n_hid
,
n_hid
),
low
=-
1
,
high
=
1
))
h0_v
=
asarrayX
(
rng
.
uniform
(
size
=
(
2
,
n_hid
),
low
=-
1
,
high
=
1
))
b_h_v
=
asarrayX
(
rng
.
uniform
(
size
=
(
n_hid
),
low
=-.
01
,
high
=.
01
))
W_ih_v
=
asarrayX
(
rng
.
uniform
(
size
=
(
n_in
,
n_hid
),
low
=-
.
01
,
high
=.
0
1
))
W_ho_v
=
asarrayX
(
rng
.
uniform
(
size
=
(
n_hid
,
n_out
),
low
=-
.
01
,
high
=.
0
1
))
W_ih_v
=
asarrayX
(
rng
.
uniform
(
size
=
(
n_in
,
n_hid
),
low
=-
1
,
high
=
1
))
W_ho_v
=
asarrayX
(
rng
.
uniform
(
size
=
(
n_hid
,
n_out
),
low
=-
1
,
high
=
1
))
b_o_v
=
asarrayX
(
rng
.
uniform
(
size
=
(
n_out
),
low
=-.
01
,
high
=.
01
))
# parameters of the rnn
b_h
=
theano
.
shared
(
b_h_v
)
h0
=
theano
.
shared
(
h0_v
)
W_ih
=
theano
.
shared
(
W_ih_v
)
W_hh
=
theano
.
shared
(
W_hh_v
)
W_ho
=
theano
.
shared
(
W_ho_v
)
b_o
=
theano
.
shared
(
b_o_v
)
b_h
=
theano
.
shared
(
b_h_v
,
name
=
'b_h'
)
h0
=
theano
.
shared
(
h0_v
,
name
=
'h0'
)
W_ih
=
theano
.
shared
(
W_ih_v
,
name
=
'W_ih'
)
W_hh
=
theano
.
shared
(
W_hh_v
,
name
=
'W_hh'
)
W_ho
=
theano
.
shared
(
W_ho_v
,
name
=
'W_ho'
)
b_o
=
theano
.
shared
(
b_o_v
,
name
=
'b_o'
)
params
=
[
W_ih
,
W_hh
,
b_h
,
W_ho
,
b_o
,
h0
]
# first dimension is time
...
...
theano/tensor/tests/test_nlinalg.py
浏览文件 @
3cfdc345
...
...
@@ -15,33 +15,12 @@ from theano.tests.test_rop import break_op
from
theano.tests
import
unittest_tools
as
utt
from
theano
import
config
from
theano.tensor.nlinalg
import
(
MatrixInverse
,
matrix_inverse
,
MatrixPinv
,
pinv
,
AllocDiag
,
alloc_diag
,
ExtractDiag
,
extract_diag
,
diag
,
trace
,
Det
,
det
,
Eig
,
eig
,
Eigh
,
EighGrad
,
eigh
,
matrix_dot
,
_zero_disconnected
,
qr
,
matrix_power
,
norm
,
svd
,
TensorInv
,
tensorinv
,
tensorsolve
)
from
theano.tensor.nlinalg
import
(
MatrixInverse
,
matrix_inverse
,
MatrixPinv
,
pinv
,
AllocDiag
,
alloc_diag
,
ExtractDiag
,
extract_diag
,
diag
,
trace
,
Det
,
det
,
Eig
,
eig
,
Eigh
,
EighGrad
,
eigh
,
matrix_dot
,
_zero_disconnected
,
qr
,
matrix_power
,
norm
,
svd
,
TensorInv
,
tensorinv
,
tensorsolve
)
from
nose.plugins.attrib
import
attr
from
nose.plugins.skip
import
SkipTest
...
...
@@ -424,9 +403,9 @@ class test_Eig(utt.InferShapeTester):
super
(
test_Eig
,
self
)
.
setUp
()
self
.
rng
=
numpy
.
random
.
RandomState
(
utt
.
fetch_seed
())
self
.
A
=
theano
.
tensor
.
matrix
(
dtype
=
self
.
dtype
)
X
=
numpy
.
asarray
(
self
.
rng
.
rand
(
5
,
5
),
dtype
=
self
.
dtype
)
self
.
S
=
X
.
dot
(
X
.
T
)
self
.
X
=
numpy
.
asarray
(
self
.
rng
.
rand
(
5
,
5
),
dtype
=
self
.
dtype
)
self
.
S
=
self
.
X
.
dot
(
self
.
X
.
T
)
def
test_infer_shape
(
self
):
A
=
self
.
A
...
...
@@ -460,21 +439,21 @@ class test_Eigh(test_Eig):
vl
*
numpy
.
sign
(
vl
[
0
,
:]))
def
test_grad
(
self
):
S
=
self
.
S
utt
.
verify_grad
(
lambda
x
:
self
.
op
(
x
)[
0
],
[
S
],
rng
=
self
.
rng
)
utt
.
verify_grad
(
lambda
x
:
self
.
op
(
x
)[
1
],
[
S
],
rng
=
self
.
rng
)
utt
.
verify_grad
(
lambda
x
:
self
.
op
(
x
,
'U'
)[
0
],
[
S
],
rng
=
self
.
rng
)
utt
.
verify_grad
(
lambda
x
:
self
.
op
(
x
,
'U'
)[
1
],
[
S
],
rng
=
self
.
rng
)
X
=
self
.
X
# We need to do the dot inside the graph because Eigh needs a
# matrix that is hermitian
utt
.
verify_grad
(
lambda
x
:
self
.
op
(
x
.
dot
(
x
.
T
))[
0
],
[
X
],
rng
=
self
.
rng
)
utt
.
verify_grad
(
lambda
x
:
self
.
op
(
x
.
dot
(
x
.
T
))[
1
],
[
X
],
rng
=
self
.
rng
)
utt
.
verify_grad
(
lambda
x
:
self
.
op
(
x
.
dot
(
x
.
T
),
'U'
)[
0
],
[
X
],
rng
=
self
.
rng
)
utt
.
verify_grad
(
lambda
x
:
self
.
op
(
x
.
dot
(
x
.
T
),
'U'
)[
1
],
[
X
],
rng
=
self
.
rng
)
class
test_Eigh_float32
(
test_Eigh
):
dtype
=
'float32'
@utt.AttemptManyTimes
(
n_attempts
=
3
,
n_req_successes
=
2
)
def
test_uplo
(
self
):
super
(
test_Eigh_float32
,
self
)
.
test_uplo
()
@utt.AttemptManyTimes
(
n_attempts
=
3
,
n_req_successes
=
2
)
def
test_grad
(
self
):
super
(
test_Eigh_float32
,
self
)
.
test_grad
()
...
...
theano/tensor/tests/test_slinalg.py
浏览文件 @
3cfdc345
...
...
@@ -15,16 +15,9 @@ from theano.tensor.basic import _allclose
from
theano.tests.test_rop
import
break_op
from
theano.tests
import
unittest_tools
as
utt
from
theano
import
config
from
theano.tensor.slinalg
import
(
Cholesky
,
cholesky
,
CholeskyGrad
,
Solve
,
solve
,
Eigvalsh
,
EigvalshGrad
,
eigvalsh
,
expm
,
kron
)
from
theano.tensor.slinalg
import
(
Cholesky
,
cholesky
,
CholeskyGrad
,
Solve
,
solve
,
Eigvalsh
,
EigvalshGrad
,
eigvalsh
,
expm
,
kron
)
from
theano.tests.unittest_tools
import
attr
from
nose.plugins.skip
import
SkipTest
...
...
@@ -81,18 +74,18 @@ def test_cholesky_grad():
raise
SkipTest
(
"Scipy needed for the Cholesky op."
)
rng
=
numpy
.
random
.
RandomState
(
utt
.
fetch_seed
())
r
=
rng
.
randn
(
5
,
5
)
.
astype
(
config
.
floatX
)
pd
=
numpy
.
dot
(
r
,
r
.
T
)
eps
=
None
if
config
.
floatX
==
"float64"
:
eps
=
2e-8
# The dots are inside the graph since Cholesky needs separable matrices
# Check the default.
yield
(
lambda
:
utt
.
verify_grad
(
cholesky
,
[
pd
],
3
,
rng
,
eps
=
eps
))
yield
(
lambda
:
utt
.
verify_grad
(
lambda
r
:
cholesky
(
r
.
dot
(
r
.
T
)),
[
r
],
3
,
rng
))
# Explicit lower-triangular.
yield
(
lambda
:
utt
.
verify_grad
(
Cholesky
(
lower
=
True
),
[
pd
],
3
,
rng
,
eps
=
eps
))
yield
(
lambda
:
utt
.
verify_grad
(
lambda
r
:
Cholesky
(
lower
=
True
)(
r
.
dot
(
r
.
T
))
,
[
r
],
3
,
rng
))
# Explicit upper-triangular.
yield
(
lambda
:
utt
.
verify_grad
(
Cholesky
(
lower
=
False
),
[
pd
],
3
,
rng
,
eps
=
eps
))
yield
(
lambda
:
utt
.
verify_grad
(
lambda
r
:
Cholesky
(
lower
=
False
)(
r
.
dot
(
r
.
T
))
,
[
r
],
3
,
rng
))
@attr
(
'slow'
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论