Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ed509d18
提交
ed509d18
authored
8月 10, 2011
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add test for gemv and dot with dimensions of zeros.
上级
50605d2c
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
28 行增加
和
5 行删除
+28
-5
blas.py
theano/tensor/blas.py
+1
-1
test_basic.py
theano/tensor/tests/test_basic.py
+16
-0
test_blas.py
theano/tensor/tests/test_blas.py
+11
-4
没有找到文件。
theano/tensor/blas.py
浏览文件 @
ed509d18
...
@@ -189,7 +189,7 @@ class Gemv(Op):
...
@@ -189,7 +189,7 @@ class Gemv(Op):
def
perform
(
self
,
node
,
inputs
,
out_storage
):
def
perform
(
self
,
node
,
inputs
,
out_storage
):
y
,
alpha
,
A
,
x
,
beta
=
inputs
y
,
alpha
,
A
,
x
,
beta
=
inputs
if
_have_fblas
:
if
_have_fblas
and
y
.
shape
[
0
]
!=
0
and
x
.
shape
[
0
]
!=
0
:
gemv
=
_blas_gemv_fns
[
y
.
dtype
]
gemv
=
_blas_gemv_fns
[
y
.
dtype
]
if
(
A
.
shape
[
0
]
!=
y
.
shape
[
0
]
or
A
.
shape
[
1
]
!=
x
.
shape
[
0
]):
if
(
A
.
shape
[
0
]
!=
y
.
shape
[
0
]
or
A
.
shape
[
1
]
!=
x
.
shape
[
0
]):
...
...
theano/tensor/tests/test_basic.py
浏览文件 @
ed509d18
...
@@ -3173,11 +3173,27 @@ class t_dot(unittest.TestCase):
...
@@ -3173,11 +3173,27 @@ class t_dot(unittest.TestCase):
#def test_dot_0d_3d(self): self.cmp_dot(3.0, self.rand(8,6,7))
#def test_dot_0d_3d(self): self.cmp_dot(3.0, self.rand(8,6,7))
#def test_dot_1d_0d(self): self.cmp_dot(self.rand(5), 1.1 )
#def test_dot_1d_0d(self): self.cmp_dot(self.rand(5), 1.1 )
def
test_dot_1d_1d
(
self
):
self
.
cmp_dot
(
self
.
rand
(
5
),
self
.
rand
(
5
))
def
test_dot_1d_1d
(
self
):
self
.
cmp_dot
(
self
.
rand
(
5
),
self
.
rand
(
5
))
def
test_dot_1d0_1d0
(
self
):
self
.
cmp_dot
(
self
.
rand
(
0
),
self
.
rand
(
0
))
#numpy return matrix not aligned...
#def test_dot_1d_1d0(self): self.cmp_dot(self.rand(5), self.rand(0))
#numpy return matrix not aligned...
#def test_dot_1d0_1d(self): self.cmp_dot(self.rand(0), self.rand(5))
def
test_dot_1d_2d
(
self
):
self
.
cmp_dot
(
self
.
rand
(
6
),
self
.
rand
(
6
,
7
))
def
test_dot_1d_2d
(
self
):
self
.
cmp_dot
(
self
.
rand
(
6
),
self
.
rand
(
6
,
7
))
def
test_dot_1d0_2d
(
self
):
self
.
cmp_dot
(
self
.
rand
(
0
),
self
.
rand
(
0
,
7
))
def
test_dot_1d_2d0
(
self
):
self
.
cmp_dot
(
self
.
rand
(
6
),
self
.
rand
(
6
,
0
))
def
test_dot_1d0_2d0
(
self
):
self
.
cmp_dot
(
self
.
rand
(
0
),
self
.
rand
(
0
,
0
))
#def test_dot_1d_3d(self): self.cmp_dot(self.rand(6), self.rand(8,6,7))
#def test_dot_1d_3d(self): self.cmp_dot(self.rand(6), self.rand(8,6,7))
#def test_dot_2d_0d(self): self.cmp_dot(self.rand(5,6), 1.0)
#def test_dot_2d_0d(self): self.cmp_dot(self.rand(5,6), 1.0)
def
test_dot_2d_1d
(
self
):
self
.
cmp_dot
(
self
.
rand
(
5
,
6
),
self
.
rand
(
6
))
def
test_dot_2d_1d
(
self
):
self
.
cmp_dot
(
self
.
rand
(
5
,
6
),
self
.
rand
(
6
))
def
test_dot_2d0_1d
(
self
):
self
.
cmp_dot
(
self
.
rand
(
0
,
6
),
self
.
rand
(
6
))
def
test_dot_2d_1d0
(
self
):
self
.
cmp_dot
(
self
.
rand
(
5
,
0
),
self
.
rand
(
0
))
def
test_dot_2d0_1d0
(
self
):
self
.
cmp_dot
(
self
.
rand
(
0
,
0
),
self
.
rand
(
0
))
def
test_dot_2d_2d
(
self
):
self
.
cmp_dot
(
self
.
rand
(
5
,
6
),
self
.
rand
(
6
,
7
))
def
test_dot_2d_2d
(
self
):
self
.
cmp_dot
(
self
.
rand
(
5
,
6
),
self
.
rand
(
6
,
7
))
def
test_dot_2d0_2d
(
self
):
self
.
cmp_dot
(
self
.
rand
(
0
,
6
),
self
.
rand
(
6
,
7
))
def
test_dot_2d_2d0
(
self
):
self
.
cmp_dot
(
self
.
rand
(
5
,
6
),
self
.
rand
(
6
,
0
))
def
test_dot_2d0_2d0
(
self
):
self
.
cmp_dot
(
self
.
rand
(
0
,
6
),
self
.
rand
(
6
,
0
))
def
test_dot_2d_0_2d
(
self
):
self
.
cmp_dot
(
self
.
rand
(
5
,
0
),
self
.
rand
(
0
,
7
))
def
test_dot_2d0_0_2d0
(
self
):
self
.
cmp_dot
(
self
.
rand
(
0
,
6
),
self
.
rand
(
6
,
0
))
#def test_dot_2d_3d(self): self.cmp_dot(self.rand(5,6), self.rand(8,6,7))
#def test_dot_2d_3d(self): self.cmp_dot(self.rand(5,6), self.rand(8,6,7))
#def test_dot_3d_0d(self): self.cmp_dot(self.rand(4,5,6), 1.0)
#def test_dot_3d_0d(self): self.cmp_dot(self.rand(4,5,6), 1.0)
#def test_dot_3d_1d(self): self.cmp_dot(self.rand(4,5,6), self.rand(6))
#def test_dot_3d_1d(self): self.cmp_dot(self.rand(4,5,6), self.rand(6))
...
...
theano/tensor/tests/test_blas.py
浏览文件 @
ed509d18
...
@@ -821,13 +821,14 @@ class TestGemv(TestCase):
...
@@ -821,13 +821,14 @@ class TestGemv(TestCase):
assert
sum
([
isinstance
(
node
.
op
,
T
.
blas
.
Dot22
)
for
node
in
assert
sum
([
isinstance
(
node
.
op
,
T
.
blas
.
Dot22
)
for
node
in
f
.
maker
.
env
.
toposort
()
])
==
1
f
.
maker
.
env
.
toposort
()
])
==
1
def
test_gemv1
(
self
):
@staticmethod
def
t_gemv1
(
m_shp
):
''' test vector2+dot(matrix,vector1) '''
''' test vector2+dot(matrix,vector1) '''
rng
=
numpy
.
random
.
RandomState
(
unittest_tools
.
fetch_seed
())
rng
=
numpy
.
random
.
RandomState
(
unittest_tools
.
fetch_seed
())
v1
=
theano
.
shared
(
numpy
.
array
(
rng
.
uniform
(
size
=
(
2
,)),
dtype
=
'float32'
))
v1
=
theano
.
shared
(
numpy
.
array
(
rng
.
uniform
(
size
=
(
m_shp
[
1
]
,)),
dtype
=
'float32'
))
v2_orig
=
numpy
.
array
(
rng
.
uniform
(
size
=
(
3
,)),
dtype
=
'float32'
)
v2_orig
=
numpy
.
array
(
rng
.
uniform
(
size
=
(
m_shp
[
0
]
,)),
dtype
=
'float32'
)
v2
=
theano
.
shared
(
v2_orig
)
v2
=
theano
.
shared
(
v2_orig
)
m
=
theano
.
shared
(
numpy
.
array
(
rng
.
uniform
(
size
=
(
3
,
2
)
),
dtype
=
'float32'
))
m
=
theano
.
shared
(
numpy
.
array
(
rng
.
uniform
(
size
=
m_shp
),
dtype
=
'float32'
))
f
=
theano
.
function
([],
v2
+
theano
.
dot
(
m
,
v1
),
mode
=
mode_blas_opt
)
f
=
theano
.
function
([],
v2
+
theano
.
dot
(
m
,
v1
),
mode
=
mode_blas_opt
)
...
@@ -853,6 +854,12 @@ class TestGemv(TestCase):
...
@@ -853,6 +854,12 @@ class TestGemv(TestCase):
if
config
.
mode
!=
'FAST_COMPILE'
:
if
config
.
mode
!=
'FAST_COMPILE'
:
assert
topo
[
0
]
.
op
.
inplace
==
True
assert
topo
[
0
]
.
op
.
inplace
==
True
def
test_gemv1
(
self
):
self
.
t_gemv1
((
3
,
2
))
self
.
t_gemv1
((
0
,
2
))
self
.
t_gemv1
((
3
,
0
))
self
.
t_gemv1
((
0
,
0
))
def
test_gemv2
(
self
):
def
test_gemv2
(
self
):
''' test vector2+dot(vector1,matrix) '''
''' test vector2+dot(vector1,matrix) '''
rng
=
numpy
.
random
.
RandomState
(
unittest_tools
.
fetch_seed
())
rng
=
numpy
.
random
.
RandomState
(
unittest_tools
.
fetch_seed
())
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论