Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6f5a1844
提交
6f5a1844
authored
7月 20, 2011
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
documentation and revisions to blas optimization pipeline
上级
d36528cb
全部展开
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
18 行增加
和
14 行删除
+18
-14
blas.py
theano/tensor/blas.py
+0
-0
test_blas.py
theano/tensor/tests/test_blas.py
+18
-14
没有找到文件。
theano/tensor/blas.py
浏览文件 @
6f5a1844
差异被折叠。
点击展开。
theano/tensor/tests/test_blas.py
浏览文件 @
6f5a1844
...
@@ -83,7 +83,7 @@ class t_gemm(TestCase):
...
@@ -83,7 +83,7 @@ class t_gemm(TestCase):
Gemm
.
debug
=
True
Gemm
.
debug
=
True
try
:
try
:
g
=
gemm_inplace
([
1.
],
1.
,
[
1.
],
[
1.
],
1.
)
g
=
gemm_inplace
([
1.
],
1.
,
[
1.
],
[
1.
],
1.
)
except
Valu
eError
,
e
:
except
Typ
eError
,
e
:
if
e
[
0
]
is
Gemm
.
E_rank
:
if
e
[
0
]
is
Gemm
.
E_rank
:
return
return
self
.
fail
()
self
.
fail
()
...
@@ -91,7 +91,7 @@ class t_gemm(TestCase):
...
@@ -91,7 +91,7 @@ class t_gemm(TestCase):
def
test0
(
self
):
def
test0
(
self
):
try
:
try
:
self
.
cmp
(
1.
,
0.
,
1.0
,
1.0
,
1.0
)
self
.
cmp
(
1.
,
0.
,
1.0
,
1.0
,
1.0
)
except
Valu
eError
,
e
:
except
Typ
eError
,
e
:
if
e
[
0
]
is
Gemm
.
E_rank
:
if
e
[
0
]
is
Gemm
.
E_rank
:
return
return
self
.
fail
()
self
.
fail
()
...
@@ -99,7 +99,7 @@ class t_gemm(TestCase):
...
@@ -99,7 +99,7 @@ class t_gemm(TestCase):
def
test2
(
self
):
def
test2
(
self
):
try
:
try
:
self
.
cmp
(
2.
,
1.0
,
[
3
,
2
,
1.
],
[[
1
],[
2
],[
3.
]],
1.0
)
self
.
cmp
(
2.
,
1.0
,
[
3
,
2
,
1.
],
[[
1
],[
2
],[
3.
]],
1.0
)
except
Valu
eError
,
e
:
except
Typ
eError
,
e
:
self
.
assertTrue
(
e
[
0
]
==
Gemm
.
E_rank
)
self
.
assertTrue
(
e
[
0
]
==
Gemm
.
E_rank
)
return
return
self
.
fail
()
self
.
fail
()
...
@@ -124,14 +124,14 @@ class t_gemm(TestCase):
...
@@ -124,14 +124,14 @@ class t_gemm(TestCase):
self
.
rand
(
3
,
5
),
self
.
rand
(
5
,
4
),
-
1.0
)
self
.
rand
(
3
,
5
),
self
.
rand
(
5
,
4
),
-
1.0
)
def
test_factorised_scalar
(
self
):
def
test_factorised_scalar
(
self
):
a
=
T
.
matrix
()
a
=
T
.
d
matrix
()
b
=
T
.
matrix
()
b
=
T
.
d
matrix
()
c
=
T
.
matrix
()
c
=
T
.
d
matrix
()
s
=
theano
.
shared
(
numpy
.
zeros
((
5
,
5
)))
s
=
theano
.
shared
(
numpy
.
zeros
((
5
,
5
)))
lr1
=
T
.
constant
(
0.01
)
lr1
=
T
.
constant
(
0.01
)
.
astype
(
'float64'
)
lr2
=
T
.
constant
(
2
)
lr2
=
T
.
constant
(
2
)
.
astype
(
'float64'
)
l2_reg
=
T
.
constant
(
0.0001
)
l2_reg
=
T
.
constant
(
0.0001
)
.
astype
(
'float64'
)
#test constant merge with gemm
#test constant merge with gemm
f
=
theano
.
function
([
a
,
b
],
updates
=
{
s
:
lr1
*
T
.
dot
(
a
,
b
)
+
l2_reg
*
lr2
*
s
},
mode
=
mode_not_fast_compile
)
.
maker
.
env
.
toposort
()
f
=
theano
.
function
([
a
,
b
],
updates
=
{
s
:
lr1
*
T
.
dot
(
a
,
b
)
+
l2_reg
*
lr2
*
s
},
mode
=
mode_not_fast_compile
)
.
maker
.
env
.
toposort
()
...
@@ -195,9 +195,10 @@ class t_gemm(TestCase):
...
@@ -195,9 +195,10 @@ class t_gemm(TestCase):
"""test that dot args can be aliased"""
"""test that dot args can be aliased"""
Z
=
shared
(
self
.
rand
(
2
,
2
))
Z
=
shared
(
self
.
rand
(
2
,
2
))
A
=
shared
(
self
.
rand
(
2
,
2
))
A
=
shared
(
self
.
rand
(
2
,
2
))
f
=
inplace_func
([],
gemm_inplace
(
Z
,
1.0
,
A
,
A
,
1.0
))
one
=
T
.
constant
(
1.0
)
.
astype
(
Z
.
dtype
)
f
=
inplace_func
([],
gemm_inplace
(
Z
,
one
,
A
,
A
,
one
))
f
()
f
()
f
=
inplace_func
([],
gemm_inplace
(
Z
,
1.0
,
A
,
A
.
T
,
1.0
))
f
=
inplace_func
([],
gemm_inplace
(
Z
,
one
,
A
,
A
.
T
,
one
))
f
()
f
()
def
test_transposes
(
self
):
def
test_transposes
(
self
):
...
@@ -451,7 +452,8 @@ def test_gemm_opt_double_gemm():
...
@@ -451,7 +452,8 @@ def test_gemm_opt_double_gemm():
ishapes
=
[(
4
,
3
),
(
3
,
5
),
(
4
,
5
),
(),
(),
(
5
,
9
),
(
9
,
4
),
()]
ishapes
=
[(
4
,
3
),
(
3
,
5
),
(
4
,
5
),
(),
(),
(
5
,
9
),
(
9
,
4
),
()]
i
=
[
X
,
Y
,
Z
,
a
,
b
,
R
,
S
,
c
]
i
=
[
X
,
Y
,
Z
,
a
,
b
,
R
,
S
,
c
]
o
=
[
a
*
T
.
dot
(
X
,
Y
)
+
gemm_inplace
(
Z
,
b
,
S
.
T
,
R
.
T
,
1.0
)]
o
=
[(
a
*
T
.
dot
(
X
,
Y
)
+
gemm_inplace
(
Z
,
b
,
S
.
T
,
R
.
T
,
T
.
constant
(
1.0
)
.
astype
(
'float64'
)))]
try
:
try
:
f
=
inplace_func
([
Param
(
ii
,
mutable
=
True
)
for
ii
in
i
],
o
,
f
=
inplace_func
([
Param
(
ii
,
mutable
=
True
)
for
ii
in
i
],
o
,
mode
=
'FAST_RUN'
)
mode
=
'FAST_RUN'
)
...
@@ -765,8 +767,9 @@ def test_dot_vm():
...
@@ -765,8 +767,9 @@ def test_dot_vm():
# Assert they produce the same output
# Assert they produce the same output
assert
numpy
.
allclose
(
f
(),
numpy
.
dot
(
v
.
get_value
(),
m
.
get_value
()))
assert
numpy
.
allclose
(
f
(),
numpy
.
dot
(
v
.
get_value
(),
m
.
get_value
()))
# Assert that the dot was optimized somehow
assert
sum
([
isinstance
(
node
.
op
,
T
.
Dot
)
for
node
in
assert
sum
([
isinstance
(
node
.
op
,
T
.
Dot
)
for
node
in
f
.
maker
.
env
.
toposort
()
])
==
1
f
.
maker
.
env
.
toposort
()
])
==
0
def
test_dot_mv
():
def
test_dot_mv
():
''' Test matrix dot vector '''
''' Test matrix dot vector '''
...
@@ -779,8 +782,9 @@ def test_dot_mv():
...
@@ -779,8 +782,9 @@ def test_dot_mv():
# Assert they produce the same output
# Assert they produce the same output
assert
numpy
.
allclose
(
f
(),
numpy
.
dot
(
m
.
get_value
(),
v
.
get_value
()))
assert
numpy
.
allclose
(
f
(),
numpy
.
dot
(
m
.
get_value
(),
v
.
get_value
()))
# Assert that the dot was optimized somehow
assert
sum
([
isinstance
(
node
.
op
,
T
.
Dot
)
for
node
in
assert
sum
([
isinstance
(
node
.
op
,
T
.
Dot
)
for
node
in
f
.
maker
.
env
.
toposort
()
])
==
1
f
.
maker
.
env
.
toposort
()
])
==
0
class
TestGemv
(
TestCase
):
class
TestGemv
(
TestCase
):
def
test_gemv1
(
self
):
def
test_gemv1
(
self
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论