Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
929bb073
提交
929bb073
authored
11月 29, 2012
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pep8
上级
5f58b6fc
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
14 行增加
和
6 行删除
+14
-6
test_linalg.py
theano/sandbox/linalg/tests/test_linalg.py
+14
-6
没有找到文件。
theano/sandbox/linalg/tests/test_linalg.py
浏览文件 @
929bb073
...
@@ -185,6 +185,7 @@ def test_inverse_grad():
...
@@ -185,6 +185,7 @@ def test_inverse_grad():
r
=
rng
.
randn
(
4
,
4
)
r
=
rng
.
randn
(
4
,
4
)
tensor
.
verify_grad
(
matrix_inverse
,
[
r
],
rng
=
numpy
.
random
)
tensor
.
verify_grad
(
matrix_inverse
,
[
r
],
rng
=
numpy
.
random
)
def
test_rop_lop
():
def
test_rop_lop
():
mx
=
tensor
.
matrix
(
'mx'
)
mx
=
tensor
.
matrix
(
'mx'
)
mv
=
tensor
.
matrix
(
'mv'
)
mv
=
tensor
.
matrix
(
'mv'
)
...
@@ -442,6 +443,7 @@ def test_spectral_radius_bound():
...
@@ -442,6 +443,7 @@ def test_spectral_radius_bound():
ok
=
True
ok
=
True
assert
ok
assert
ok
class
test_Solve
(
utt
.
InferShapeTester
):
class
test_Solve
(
utt
.
InferShapeTester
):
def
setUp
(
self
):
def
setUp
(
self
):
super
(
test_Solve
,
self
)
.
setUp
()
super
(
test_Solve
,
self
)
.
setUp
()
...
@@ -474,10 +476,12 @@ class test_Solve(utt.InferShapeTester):
...
@@ -474,10 +476,12 @@ class test_Solve(utt.InferShapeTester):
dtype
=
config
.
floatX
)],
dtype
=
config
.
floatX
)],
self
.
op_class
)
self
.
op_class
)
class
test_Eig
(
utt
.
InferShapeTester
):
class
test_Eig
(
utt
.
InferShapeTester
):
op_class
=
Eig
op_class
=
Eig
op
=
eig
op
=
eig
dtype
=
'float64'
dtype
=
'float64'
def
setUp
(
self
):
def
setUp
(
self
):
super
(
test_Eig
,
self
)
.
setUp
()
super
(
test_Eig
,
self
)
.
setUp
()
self
.
rng
=
numpy
.
random
.
RandomState
(
utt
.
fetch_seed
())
self
.
rng
=
numpy
.
random
.
RandomState
(
utt
.
fetch_seed
())
...
@@ -485,7 +489,7 @@ class test_Eig(utt.InferShapeTester):
...
@@ -485,7 +489,7 @@ class test_Eig(utt.InferShapeTester):
X
=
numpy
.
asarray
(
self
.
rng
.
rand
(
5
,
5
),
X
=
numpy
.
asarray
(
self
.
rng
.
rand
(
5
,
5
),
dtype
=
self
.
dtype
)
dtype
=
self
.
dtype
)
self
.
S
=
X
.
dot
(
X
.
T
)
self
.
S
=
X
.
dot
(
X
.
T
)
def
test_infer_shape
(
self
):
def
test_infer_shape
(
self
):
A
=
self
.
A
A
=
self
.
A
S
=
self
.
S
S
=
self
.
S
...
@@ -494,26 +498,29 @@ class test_Eig(utt.InferShapeTester):
...
@@ -494,26 +498,29 @@ class test_Eig(utt.InferShapeTester):
# S must be square
# S must be square
[
S
],
[
S
],
self
.
op_class
)
self
.
op_class
)
def
test_eval
(
self
):
def
test_eval
(
self
):
import
math
import
math
A
=
theano
.
tensor
.
matrix
(
dtype
=
self
.
dtype
)
A
=
theano
.
tensor
.
matrix
(
dtype
=
self
.
dtype
)
self
.
assertEquals
([
e
.
eval
({
A
:
[[
1
]]})
for
e
in
self
.
op
(
A
)],
self
.
assertEquals
([
e
.
eval
({
A
:
[[
1
]]})
for
e
in
self
.
op
(
A
)],
[[
1.0
],
[[
1.0
]]])
[[
1.0
],
[[
1.0
]]])
x
=
[[
0
,
1
],
[
1
,
0
]]
x
=
[[
0
,
1
],
[
1
,
0
]]
w
,
v
=
[
e
.
eval
({
A
:
x
})
for
e
in
self
.
op
(
A
)]
w
,
v
=
[
e
.
eval
({
A
:
x
})
for
e
in
self
.
op
(
A
)]
assert_array_almost_equal
(
numpy
.
dot
(
x
,
v
),
w
*
v
)
assert_array_almost_equal
(
numpy
.
dot
(
x
,
v
),
w
*
v
)
class
test_Eigh
(
test_Eig
):
class
test_Eigh
(
test_Eig
):
op
=
staticmethod
(
eigh
)
op
=
staticmethod
(
eigh
)
def
test_uplo
(
self
):
def
test_uplo
(
self
):
S
=
self
.
S
S
=
self
.
S
a
=
theano
.
tensor
.
matrix
(
dtype
=
self
.
dtype
)
a
=
theano
.
tensor
.
matrix
(
dtype
=
self
.
dtype
)
wu
,
vu
=
[
out
.
eval
({
a
:
S
})
for
out
in
self
.
op
(
a
,
'U'
)]
wu
,
vu
=
[
out
.
eval
({
a
:
S
})
for
out
in
self
.
op
(
a
,
'U'
)]
wl
,
vl
=
[
out
.
eval
({
a
:
S
})
for
out
in
self
.
op
(
a
,
'L'
)]
wl
,
vl
=
[
out
.
eval
({
a
:
S
})
for
out
in
self
.
op
(
a
,
'L'
)]
assert_array_almost_equal
(
wu
,
wl
)
assert_array_almost_equal
(
wu
,
wl
)
assert_array_almost_equal
(
vu
*
numpy
.
sign
(
vu
[
0
,
:]),
assert_array_almost_equal
(
vu
*
numpy
.
sign
(
vu
[
0
,
:]),
vl
*
numpy
.
sign
(
vl
[
0
,
:]))
vl
*
numpy
.
sign
(
vl
[
0
,
:]))
def
test_grad
(
self
):
def
test_grad
(
self
):
S
=
self
.
S
S
=
self
.
S
utt
.
verify_grad
(
lambda
x
:
self
.
op
(
x
)[
0
],
[
S
],
rng
=
self
.
rng
)
utt
.
verify_grad
(
lambda
x
:
self
.
op
(
x
)[
0
],
[
S
],
rng
=
self
.
rng
)
...
@@ -521,5 +528,6 @@ class test_Eigh(test_Eig):
...
@@ -521,5 +528,6 @@ class test_Eigh(test_Eig):
utt
.
verify_grad
(
lambda
x
:
self
.
op
(
x
,
'U'
)[
0
],
[
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
)
utt
.
verify_grad
(
lambda
x
:
self
.
op
(
x
,
'U'
)[
1
],
[
S
],
rng
=
self
.
rng
)
class
test_Eigh_float32
(
test_Eigh
):
class
test_Eigh_float32
(
test_Eigh
):
dtype
=
'float32'
dtype
=
'float32'
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论