Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1cda3cfc
提交
1cda3cfc
authored
8月 30, 2016
作者:
yobibyte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix rebase. Make flake8 silent.
上级
f1f333d0
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
12 行增加
和
10 行删除
+12
-10
nlinalg.py
theano/tensor/nlinalg.py
+2
-0
test_nlinalg.py
theano/tensor/tests/test_nlinalg.py
+10
-10
没有找到文件。
theano/tensor/nlinalg.py
浏览文件 @
1cda3cfc
...
@@ -794,6 +794,7 @@ def tensorinv(a, ind=2):
...
@@ -794,6 +794,7 @@ def tensorinv(a, ind=2):
"""
"""
return
TensorInv
(
ind
)(
a
)
return
TensorInv
(
ind
)(
a
)
class
TensorSolve
(
Op
):
class
TensorSolve
(
Op
):
"""
"""
Theano utilization of numpy.linalg.tensorsolve
Theano utilization of numpy.linalg.tensorsolve
...
@@ -848,5 +849,6 @@ def tensorsolve(a, b, axes=None):
...
@@ -848,5 +849,6 @@ def tensorsolve(a, b, axes=None):
------
------
LinAlgError
LinAlgError
If `a` is singular or not 'square' (in the above sense).
If `a` is singular or not 'square' (in the above sense).
"""
return
TensorSolve
(
axes
)(
a
,
b
)
return
TensorSolve
(
axes
)(
a
,
b
)
theano/tensor/tests/test_nlinalg.py
浏览文件 @
1cda3cfc
...
@@ -39,7 +39,7 @@ from theano.tensor.nlinalg import ( MatrixInverse,
...
@@ -39,7 +39,7 @@ from theano.tensor.nlinalg import ( MatrixInverse,
norm
,
norm
,
svd
,
svd
,
TensorInv
,
TensorInv
,
tensorinv
tensorinv
,
tensorsolve
tensorsolve
)
)
from
nose.plugins.attrib
import
attr
from
nose.plugins.attrib
import
attr
...
@@ -172,9 +172,9 @@ def test_tensorsolve():
...
@@ -172,9 +172,9 @@ def test_tensorsolve():
fn
=
function
([
A
,
B
],
[
X
])
fn
=
function
([
A
,
B
],
[
X
])
# slightly modified example from numpy.linalg.tensorsolve docstring
# slightly modified example from numpy.linalg.tensorsolve docstring
a
=
numpy
.
eye
(
2
*
3
*
4
)
.
astype
(
theano
.
config
.
floatX
)
a
=
numpy
.
eye
(
2
*
3
*
4
)
.
astype
(
theano
.
config
.
floatX
)
a
.
shape
=
(
2
*
3
,
4
,
2
,
3
*
4
)
a
.
shape
=
(
2
*
3
,
4
,
2
,
3
*
4
)
b
=
rng
.
rand
(
2
*
3
,
4
)
.
astype
(
theano
.
config
.
floatX
)
b
=
rng
.
rand
(
2
*
3
,
4
)
.
astype
(
theano
.
config
.
floatX
)
n_x
=
numpy
.
linalg
.
tensorsolve
(
a
,
b
)
n_x
=
numpy
.
linalg
.
tensorsolve
(
a
,
b
)
t_x
=
fn
(
a
,
b
)
t_x
=
fn
(
a
,
b
)
...
@@ -186,9 +186,9 @@ def test_tensorsolve():
...
@@ -186,9 +186,9 @@ def test_tensorsolve():
Y
=
tensorsolve
(
C
,
D
)
Y
=
tensorsolve
(
C
,
D
)
fn
=
function
([
C
,
D
],
[
Y
])
fn
=
function
([
C
,
D
],
[
Y
])
c
=
numpy
.
eye
(
2
*
3
*
4
)
.
astype
(
'float32'
)
c
=
numpy
.
eye
(
2
*
3
*
4
,
dtype
=
'float32'
)
c
.
shape
=
(
2
*
3
,
4
,
2
,
3
*
4
)
c
.
shape
=
(
2
*
3
,
4
,
2
,
3
*
4
)
d
=
rng
.
rand
(
2
*
3
,
4
)
.
astype
(
'float64'
)
d
=
rng
.
rand
(
2
*
3
,
4
)
.
astype
(
'float64'
)
n_y
=
numpy
.
linalg
.
tensorsolve
(
c
,
d
)
n_y
=
numpy
.
linalg
.
tensorsolve
(
c
,
d
)
t_y
=
fn
(
c
,
d
)
t_y
=
fn
(
c
,
d
)
assert
_allclose
(
n_y
,
t_y
)
assert
_allclose
(
n_y
,
t_y
)
...
@@ -200,9 +200,9 @@ def test_tensorsolve():
...
@@ -200,9 +200,9 @@ def test_tensorsolve():
Z
=
tensorsolve
(
E
,
F
)
Z
=
tensorsolve
(
E
,
F
)
fn
=
function
([
E
,
F
],
[
Z
])
fn
=
function
([
E
,
F
],
[
Z
])
e
=
numpy
.
eye
(
2
*
3
*
4
)
.
astype
(
'int32'
)
e
=
numpy
.
eye
(
2
*
3
*
4
,
dtype
=
'int32'
)
e
.
shape
=
(
2
*
3
,
4
,
2
,
3
*
4
)
e
.
shape
=
(
2
*
3
,
4
,
2
,
3
*
4
)
f
=
rng
.
rand
(
2
*
3
,
4
)
.
astype
(
'float64'
)
f
=
rng
.
rand
(
2
*
3
,
4
)
.
astype
(
'float64'
)
n_z
=
numpy
.
linalg
.
tensorsolve
(
e
,
f
)
n_z
=
numpy
.
linalg
.
tensorsolve
(
e
,
f
)
t_z
=
fn
(
e
,
f
)
t_z
=
fn
(
e
,
f
)
assert
_allclose
(
n_z
,
t_z
)
assert
_allclose
(
n_z
,
t_z
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论