Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e5978249
提交
e5978249
authored
9月 17, 2012
作者:
Ian Goodfellow
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
changed references to GpuSum to now use GpuCAReduce
上级
2a1aae56
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
10 行增加
和
10 行删除
+10
-10
__init__.py
theano/sandbox/cuda/__init__.py
+1
-1
opt.py
theano/sandbox/cuda/opt.py
+3
-3
test_basic_ops.py
theano/sandbox/cuda/tests/test_basic_ops.py
+3
-3
test_driver.py
theano/sandbox/cuda/tests/test_driver.py
+1
-1
test_opt.py
theano/sandbox/cuda/tests/test_opt.py
+2
-2
没有找到文件。
theano/sandbox/cuda/__init__.py
浏览文件 @
e5978249
...
...
@@ -270,7 +270,7 @@ if cuda_available:
import
basic_ops
from
basic_ops
import
(
GpuFromHost
,
HostFromGpu
,
GpuElemwise
,
GpuDimShuffle
,
Gpu
Sum
,
GpuReshape
,
GpuContiguous
,
GpuDimShuffle
,
Gpu
CAReduce
,
GpuReshape
,
GpuContiguous
,
GpuSubtensor
,
GpuIncSubtensor
,
GpuAdvancedSubtensor1
,
GpuAdvancedIncSubtensor1
,
GpuFlatten
,
GpuShape
,
GpuAlloc
,
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
e5978249
...
...
@@ -593,7 +593,7 @@ def local_gpu_sum(node):
for
a
in
node
.
op
.
axis
:
assert
reduce_mask
[
a
]
==
0
reduce_mask
[
a
]
=
1
gsum
=
Gpu
Sum
(
reduce_mask
)
gsum
=
Gpu
CAReduce
(
reduce_mask
,
theano
.
scalar
.
basic
.
add
)
pattern
=
(
''
.
join
(
str
(
i
)
for
i
in
reduce_mask
))
if
hasattr
(
gsum
,
'c_code_reduce_
%
s'
%
pattern
):
rval
=
host_from_gpu
(
gsum
(
gpu_from_host
(
x
)))
...
...
@@ -625,7 +625,7 @@ def local_gpu_sum(node):
new_in_shp
.
append
(
x_shape
[
i
])
pattern
=
(
''
.
join
(
str
(
i
)
for
i
in
new_mask
))
new_gsum
=
Gpu
Sum
(
new_mask
)
new_gsum
=
Gpu
CAReduce
(
new_mask
,
theano
.
scalar
.
basic
.
add
)
if
hasattr
(
new_gsum
,
'c_code_reduce_
%
s'
%
pattern
):
reshaped_x
=
x
.
reshape
(
tensor
.
stack
(
*
new_in_shp
))
sum_reshaped_x
=
host_from_gpu
(
...
...
@@ -644,7 +644,7 @@ def local_gpu_sum(node):
return
None
raise
Exception
(
"Gpu
Sum
don't have implemented the pattern"
,
"Gpu
CAReduce
don't have implemented the pattern"
,
pattern
)
return
False
...
...
theano/sandbox/cuda/tests/test_basic_ops.py
浏览文件 @
e5978249
...
...
@@ -108,7 +108,7 @@ def test_sum():
val
=
theano
.
_asarray
(
val
,
dtype
=
'float32'
)
f
=
theano
.
function
([
a
],
b
,
mode
=
mode_with_gpu
)
f2
=
theano
.
function
([
a
],
b
,
mode
=
mode_without_gpu
)
assert
tcn
.
Gpu
Sum
in
[
x
.
op
.
__class__
for
x
in
f
.
maker
.
fgraph
.
toposort
()]
assert
tcn
.
Gpu
CAReduce
in
[
x
.
op
.
__class__
for
x
in
f
.
maker
.
fgraph
.
toposort
()]
assert
T
.
Sum
in
[
x
.
op
.
__class__
for
x
in
f2
.
maker
.
fgraph
.
toposort
()]
if
val
.
size
==
0
:
assert
f2
(
val
)
==
f
(
val
),
(
'shape'
,
shape
,
'pattern'
,
pattern
)
...
...
@@ -145,7 +145,7 @@ def test_sum():
val
=
theano
.
_asarray
(
val
,
dtype
=
'float32'
)
f
=
theano
.
function
([
a
],
b
,
mode
=
mode_with_gpu
)
f2
=
theano
.
function
([
a
],
b
,
mode
=
mode_without_gpu
)
assert
tcn
.
Gpu
Sum
in
[
x
.
op
.
__class__
for
x
in
f
.
maker
.
fgraph
.
toposort
()]
assert
tcn
.
Gpu
CAReduce
in
[
x
.
op
.
__class__
for
x
in
f
.
maker
.
fgraph
.
toposort
()]
assert
T
.
Sum
in
[
x
.
op
.
__class__
for
x
in
f2
.
maker
.
fgraph
.
toposort
()]
assert
_allclose
(
f2
(
val
),
f
(
val
)),
(
'shape'
,
shape
,
'pattern'
,
pattern
,
...
...
@@ -181,7 +181,7 @@ def test_sum():
val2
=
val2
[::
2
,
::
2
,
::
2
,
::
2
]
f
=
theano
.
function
([
a
],
b
,
mode
=
mode_without_gpu
)
f2
=
theano
.
function
([
a2
],
b2
,
mode
=
mode_with_gpu
)
assert
tcn
.
Gpu
Sum
in
[
x
.
op
.
__class__
for
x
in
f2
.
maker
.
fgraph
.
toposort
()]
assert
tcn
.
Gpu
CAReduce
in
[
x
.
op
.
__class__
for
x
in
f2
.
maker
.
fgraph
.
toposort
()]
assert
T
.
Sum
in
[
x
.
op
.
__class__
for
x
in
f
.
maker
.
fgraph
.
toposort
()]
assert
_allclose
(
f2
(
val2
),
f
(
val
)),
(
'shape'
,
shape
,
'pattern'
,
pattern
,
...
...
theano/sandbox/cuda/tests/test_driver.py
浏览文件 @
e5978249
...
...
@@ -28,7 +28,7 @@ def test_nvidia_driver1():
profile
=
False
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
assert
len
(
topo
)
==
2
assert
sum
(
isinstance
(
node
.
op
,
B
.
Gpu
Sum
)
for
node
in
topo
)
==
1
assert
sum
(
isinstance
(
node
.
op
,
B
.
Gpu
CAReduce
)
for
node
in
topo
)
==
1
if
not
numpy
.
allclose
(
f
(),
a
.
sum
()):
raise
Exception
(
"The nvidia driver version installed with this OS "
"does not give good results for reduction."
...
...
theano/sandbox/cuda/tests/test_opt.py
浏览文件 @
e5978249
...
...
@@ -44,11 +44,11 @@ def test_int_pow():
f
=
theano
.
function
([
a
],
(
a
*
4
)
.
sum
(),
mode
=
mode_with_gpu
)
op_names
=
[
n
.
op
.
__class__
.
__name__
for
n
in
f
.
maker
.
fgraph
.
toposort
()]
assert
op_names
==
[
'Gpu
Sum
'
,
'GpuElemwise'
,
'HostFromGpu'
]
assert
op_names
==
[
'Gpu
CAReduce
'
,
'GpuElemwise'
,
'HostFromGpu'
]
f
=
theano
.
function
([
a
],
tensor
.
pow
(
a
,
4
)
.
sum
(),
mode
=
mode_with_gpu
)
op_names
=
[
n
.
op
.
__class__
.
__name__
for
n
in
f
.
maker
.
fgraph
.
toposort
()]
assert
op_names
==
[
'GpuElemwise'
,
'Gpu
Sum
'
,
'HostFromGpu'
]
assert
op_names
==
[
'GpuElemwise'
,
'Gpu
CAReduce
'
,
'HostFromGpu'
]
#theano.printing.debugprint(f)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论