Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
cfd94c87
提交
cfd94c87
authored
1月 26, 2011
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added test for crah fix in commit 7879429f6a by Dumi. Fix another crash that new tests discovered.
上级
2dbb7baa
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
8 行增加
和
8 行删除
+8
-8
opt.py
theano/sandbox/cuda/opt.py
+2
-2
test_vector_matrix_dot.py
theano/sandbox/cuda/tests/test_vector_matrix_dot.py
+6
-6
没有找到文件。
theano/sandbox/cuda/opt.py
浏览文件 @
cfd94c87
...
@@ -183,7 +183,7 @@ def local_gpu_dot_to_dot22(node):
...
@@ -183,7 +183,7 @@ def local_gpu_dot_to_dot22(node):
# case one: vector X matrix
# case one: vector X matrix
if
_is_real_vector
(
x
)
and
_is_real_matrix
(
y
):
if
_is_real_vector
(
x
)
and
_is_real_matrix
(
y
):
new_op
=
GpuDimShuffle
((
False
,),
[
'x'
,
0
])
new_op
=
GpuDimShuffle
((
False
,),
[
'x'
,
0
])
shape_out
=
y
.
shape
[
0
]
.
dimshuffle
([
'x'
])
shape_out
=
y
.
shape
[
1
]
.
dimshuffle
([
'x'
])
gpu_x
=
new_op
(
gpu_from_host
(
x
))
gpu_x
=
new_op
(
gpu_from_host
(
x
))
gpu_y
=
gpu_from_host
(
y
)
gpu_y
=
gpu_from_host
(
y
)
# case two: matrix X vector
# case two: matrix X vector
...
@@ -201,7 +201,7 @@ def local_gpu_dot_to_dot22(node):
...
@@ -201,7 +201,7 @@ def local_gpu_dot_to_dot22(node):
x
,
y
=
node
.
inputs
x
,
y
=
node
.
inputs
if
_is_real_vector
(
x
)
and
_is_real_matrix
(
y
):
if
_is_real_vector
(
x
)
and
_is_real_matrix
(
y
):
new_op
=
GpuDimShuffle
((
False
,),
[
'x'
,
0
])
new_op
=
GpuDimShuffle
((
False
,),
[
'x'
,
0
])
shape_out
=
y
.
shape
[
0
]
.
dimshuffle
([
'x'
])
shape_out
=
y
.
shape
[
1
]
.
dimshuffle
([
'x'
])
gpu_x
=
new_op
(
gpu_from_host
(
x
))
gpu_x
=
new_op
(
gpu_from_host
(
x
))
gpu_y
=
gpu_from_host
(
y
)
gpu_y
=
gpu_from_host
(
y
)
...
...
theano/sandbox/cuda/tests/test_vector_matrix_dot.py
浏览文件 @
cfd94c87
...
@@ -26,7 +26,7 @@ else:
...
@@ -26,7 +26,7 @@ else:
def
test_dot_vm
():
def
test_dot_vm
():
''' Test vector dot matrix '''
''' Test vector dot matrix '''
v
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
2
),
dtype
=
'float32'
))
v
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
2
),
dtype
=
'float32'
))
m
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
2
,
2
),
m
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
2
,
5
),
dtype
=
'float32'
))
dtype
=
'float32'
))
no_gpu_f
=
theano
.
function
([],
theano
.
dot
(
v
,
m
),
mode
=
mode_without_gpu
)
no_gpu_f
=
theano
.
function
([],
theano
.
dot
(
v
,
m
),
mode
=
mode_without_gpu
)
gpu_f
=
theano
.
function
([],
theano
.
dot
(
v
,
m
),
mode
=
mode_with_gpu
)
gpu_f
=
theano
.
function
([],
theano
.
dot
(
v
,
m
),
mode
=
mode_with_gpu
)
...
@@ -46,7 +46,7 @@ def test_dot_vm():
...
@@ -46,7 +46,7 @@ def test_dot_vm():
def
test_dot_mv
():
def
test_dot_mv
():
''' Test matrix dot vector '''
''' Test matrix dot vector '''
v
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
2
),
dtype
=
'float32'
))
v
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
2
),
dtype
=
'float32'
))
m
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
2
,
2
),
m
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
5
,
2
),
dtype
=
'float32'
))
dtype
=
'float32'
))
no_gpu_f
=
theano
.
function
([],
theano
.
dot
(
m
,
v
),
mode
=
mode_without_gpu
)
no_gpu_f
=
theano
.
function
([],
theano
.
dot
(
m
,
v
),
mode
=
mode_without_gpu
)
gpu_f
=
theano
.
function
([],
theano
.
dot
(
m
,
v
),
mode
=
mode_with_gpu
)
gpu_f
=
theano
.
function
([],
theano
.
dot
(
m
,
v
),
mode
=
mode_with_gpu
)
...
@@ -66,8 +66,8 @@ def test_dot_mv():
...
@@ -66,8 +66,8 @@ def test_dot_mv():
def
test_gemv1
():
def
test_gemv1
():
''' test vector1+dot(matrix,vector2) '''
''' test vector1+dot(matrix,vector2) '''
v1
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
2
)
,
dtype
=
'float32'
))
v1
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
2
)
,
dtype
=
'float32'
))
v2
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
2
)
,
dtype
=
'float32'
))
v2
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
5
)
,
dtype
=
'float32'
))
m
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
2
,
2
),
dtype
=
'float32'
))
m
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
5
,
2
),
dtype
=
'float32'
))
no_gpu_f
=
theano
.
function
([],
v2
+
theano
.
dot
(
m
,
v1
),
mode
=
mode_without_gpu
)
no_gpu_f
=
theano
.
function
([],
v2
+
theano
.
dot
(
m
,
v1
),
mode
=
mode_without_gpu
)
gpu_f
=
theano
.
function
([],
v2
+
theano
.
dot
(
m
,
v1
),
mode
=
mode_with_gpu
)
gpu_f
=
theano
.
function
([],
v2
+
theano
.
dot
(
m
,
v1
),
mode
=
mode_with_gpu
)
...
@@ -87,9 +87,9 @@ def test_gemv1():
...
@@ -87,9 +87,9 @@ def test_gemv1():
def
test_gemv2
():
def
test_gemv2
():
''' test vector1+dot(vector2,matrix) '''
''' test vector1+dot(vector2,matrix) '''
v1
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
2
)
,
dtype
=
'float32'
))
v1
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
5
)
,
dtype
=
'float32'
))
v2
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
2
)
,
dtype
=
'float32'
))
v2
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
2
)
,
dtype
=
'float32'
))
m
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
2
,
2
),
dtype
=
'float32'
))
m
=
theano
.
shared
(
numpy
.
array
(
numpy
.
random
.
rand
(
5
,
2
),
dtype
=
'float32'
))
no_gpu_f
=
theano
.
function
([],
v2
+
theano
.
dot
(
v1
,
m
),
mode
=
mode_without_gpu
)
no_gpu_f
=
theano
.
function
([],
v2
+
theano
.
dot
(
v1
,
m
),
mode
=
mode_without_gpu
)
gpu_f
=
theano
.
function
([],
v2
+
theano
.
dot
(
v1
,
m
),
mode
=
mode_with_gpu
)
gpu_f
=
theano
.
function
([],
v2
+
theano
.
dot
(
v1
,
m
),
mode
=
mode_with_gpu
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论