Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
263c679f
提交
263c679f
authored
3月 18, 2013
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add assert in make_node
上级
487aa554
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
13 行增加
和
1 行删除
+13
-1
ops.py
theano/sandbox/linalg/ops.py
+13
-1
没有找到文件。
theano/sandbox/linalg/ops.py
浏览文件 @
263c679f
...
@@ -381,6 +381,7 @@ class Cholesky(Op):
...
@@ -381,6 +381,7 @@ class Cholesky(Op):
assert
imported_scipy
,
(
assert
imported_scipy
,
(
"Scipy not available. Scipy is needed for the Cholesky op"
)
"Scipy not available. Scipy is needed for the Cholesky op"
)
x
=
as_tensor_variable
(
x
)
x
=
as_tensor_variable
(
x
)
assert
x
.
ndim
==
2
return
Apply
(
self
,
[
x
],
[
x
.
type
()])
return
Apply
(
self
,
[
x
],
[
x
.
type
()])
def
perform
(
self
,
node
,
inputs
,
outputs
):
def
perform
(
self
,
node
,
inputs
,
outputs
):
...
@@ -427,6 +428,9 @@ class CholeskyGrad(Op):
...
@@ -427,6 +428,9 @@ class CholeskyGrad(Op):
x
=
as_tensor_variable
(
x
)
x
=
as_tensor_variable
(
x
)
l
=
as_tensor_variable
(
l
)
l
=
as_tensor_variable
(
l
)
dz
=
as_tensor_variable
(
dz
)
dz
=
as_tensor_variable
(
dz
)
assert
x
.
ndim
==
2
assert
l
.
ndim
==
2
assert
dz
.
ndim
==
2
assert
l
.
owner
.
op
.
lower
==
self
.
lower
,
(
assert
l
.
owner
.
op
.
lower
==
self
.
lower
,
(
"lower/upper mismatch between Cholesky op and CholeskyGrad op"
"lower/upper mismatch between Cholesky op and CholeskyGrad op"
)
)
...
@@ -510,6 +514,7 @@ class MatrixPinv(Op):
...
@@ -510,6 +514,7 @@ class MatrixPinv(Op):
def
make_node
(
self
,
x
):
def
make_node
(
self
,
x
):
x
=
as_tensor_variable
(
x
)
x
=
as_tensor_variable
(
x
)
assert
x
.
ndim
==
2
return
Apply
(
self
,
[
x
],
[
x
.
type
()])
return
Apply
(
self
,
[
x
],
[
x
.
type
()])
def
perform
(
self
,
node
,
(
x
,),
(
z
,
)):
def
perform
(
self
,
node
,
(
x
,),
(
z
,
)):
...
@@ -558,6 +563,7 @@ class MatrixInverse(Op):
...
@@ -558,6 +563,7 @@ class MatrixInverse(Op):
def
make_node
(
self
,
x
):
def
make_node
(
self
,
x
):
x
=
as_tensor_variable
(
x
)
x
=
as_tensor_variable
(
x
)
assert
x
.
ndim
==
2
return
Apply
(
self
,
[
x
],
[
x
.
type
()])
return
Apply
(
self
,
[
x
],
[
x
.
type
()])
def
perform
(
self
,
node
,
(
x
,),
(
z
,
)):
def
perform
(
self
,
node
,
(
x
,),
(
z
,
)):
...
@@ -646,6 +652,8 @@ class Solve(Op):
...
@@ -646,6 +652,8 @@ class Solve(Op):
"Scipy not available. Scipy is needed for the Solve op"
)
"Scipy not available. Scipy is needed for the Solve op"
)
A
=
as_tensor_variable
(
A
)
A
=
as_tensor_variable
(
A
)
b
=
as_tensor_variable
(
b
)
b
=
as_tensor_variable
(
b
)
assert
A
.
ndim
==
2
assert
b
.
ndim
in
[
1
,
2
]
otype
=
tensor
.
tensor
(
otype
=
tensor
.
tensor
(
broadcastable
=
b
.
broadcastable
,
broadcastable
=
b
.
broadcastable
,
dtype
=
(
A
*
b
)
.
dtype
)
dtype
=
(
A
*
b
)
.
dtype
)
...
@@ -788,6 +796,7 @@ class Det(Op):
...
@@ -788,6 +796,7 @@ class Det(Op):
"""
"""
def
make_node
(
self
,
x
):
def
make_node
(
self
,
x
):
x
=
as_tensor_variable
(
x
)
x
=
as_tensor_variable
(
x
)
assert
x
.
ndim
==
2
o
=
theano
.
tensor
.
scalar
(
dtype
=
x
.
dtype
)
o
=
theano
.
tensor
.
scalar
(
dtype
=
x
.
dtype
)
return
Apply
(
self
,
[
x
],
[
o
])
return
Apply
(
self
,
[
x
],
[
o
])
...
@@ -852,8 +861,11 @@ class A_Xinv_b(Op):
...
@@ -852,8 +861,11 @@ class A_Xinv_b(Op):
assert
imported_scipy
,
(
assert
imported_scipy
,
(
"Scipy not available. Scipy is needed for the A_Xinv_b op"
)
"Scipy not available. Scipy is needed for the A_Xinv_b op"
)
a
=
as_tensor_variable
(
a
)
a
=
as_tensor_variable
(
a
)
b
=
as_tensor_variable
(
b
)
X
=
as_tensor_variable
(
X
)
X
=
as_tensor_variable
(
X
)
b
=
as_tensor_variable
(
b
)
assert
a
.
ndim
==
2
assert
X
.
ndim
==
2
assert
b
.
ndim
==
2
o
=
theano
.
tensor
.
matrix
(
dtype
=
x
.
dtype
)
o
=
theano
.
tensor
.
matrix
(
dtype
=
x
.
dtype
)
return
Apply
(
self
,
[
a
,
X
,
b
],
[
o
])
return
Apply
(
self
,
[
a
,
X
,
b
],
[
o
])
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论