Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e9e61a44
提交
e9e61a44
authored
5月 22, 2014
作者:
Tanjay94
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed small mistake in norm and swapaxes function.
上级
43cfa11a
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
7 行增加
和
9 行删除
+7
-9
ops.py
theano/sandbox/linalg/ops.py
+5
-7
test_basic.py
theano/tensor/tests/test_basic.py
+1
-1
var.py
theano/tensor/var.py
+1
-1
没有找到文件。
theano/sandbox/linalg/ops.py
浏览文件 @
e9e61a44
...
...
@@ -1226,10 +1226,10 @@ def norm(x,ord):
x
=
as_tensor_variable
(
x
)
ndim
=
x
.
ndim
if
ndim
==
0
:
raise
TypeError
raise
ValueError
(
"'axis' entry is out of bounds."
)
elif
ndim
==
1
:
if
ord
==
None
:
z
=
(
tensor
.
sum
(
x
**
2
))
**
(
0.5
)
z
=
tensor
.
sum
(
x
**
2
)
**
0.5
return
z
elif
ord
==
'inf'
:
z
=
tensor
.
max
(
abs
(
x
))
...
...
@@ -1238,13 +1238,13 @@ def norm(x,ord):
z
=
tensor
.
min
(
abs
(
x
))
return
z
elif
ord
==
0
:
z
=
(
x
[
x
.
nonzero
()])
.
shape
[
0
]
z
=
x
[
x
.
nonzero
()]
.
shape
[
0
]
return
z
else
:
try
:
z
=
(
tensor
.
sum
(
abs
(
x
**
ord
)
))
**
(
1.
/
ord
)
z
=
tensor
.
sum
(
abs
(
x
**
ord
))
**
(
1.
/
ord
)
except
TypeError
:
raise
ValueError
raise
ValueError
(
"Invalid norm order for vectors."
)
return
z
elif
ndim
==
2
:
if
ord
==
None
or
ord
==
'fro'
:
...
...
@@ -1266,7 +1266,6 @@ def norm(x,ord):
raise
ValueError
(
0
)
class
lstsq
(
theano
.
Op
):
def
__eq__
(
self
,
other
):
pass
...
...
@@ -1292,4 +1291,3 @@ class lstsq(theano.Op):
outputs
[
1
][
0
]
=
zz
[
1
]
outputs
[
2
][
0
]
=
zz
[
2
]
outputs
[
3
][
0
]
=
zz
[
3
]
>>>>>>>
Fixed
swapaxes
function
in
var
,
indentation
error
in
test_basic
and
added
lstsq
function
in
ops
with
tests
.
theano/tensor/tests/test_basic.py
浏览文件 @
e9e61a44
...
...
@@ -6902,7 +6902,7 @@ if __name__ == '__main__':
t
.
test_infer_shape
()
class
T_swapaxes
(
unittest
.
TestCase
):
def
test_no_dimensional_input
(
self
):
def
test_no_dimensional_input
(
self
):
self
.
assertRaises
(
IndexError
,
swapaxes
,
2
,
0
,
1
)
def
test_unidimensional_input
(
self
):
...
...
theano/tensor/var.py
浏览文件 @
e9e61a44
...
...
@@ -556,7 +556,7 @@ class _tensor_py_operators:
"""see 'theano.tensor.ptp'"""
return
theano
.
tensor
.
ptp
(
self
,
axis
)
def
swapaxes
(
self
,
axis1
,
axis2
):
"""Return 'tensor.swapaxes(self, axis1, axis2)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论