Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d479efa7
提交
d479efa7
authored
9月 18, 2015
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes so that test_opt.py passes.
上级
a9c0e1ac
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
10 行增加
和
10 行删除
+10
-10
opt.py
theano/sandbox/gpuarray/opt.py
+1
-0
test_opt.py
theano/sandbox/gpuarray/tests/test_opt.py
+9
-10
没有找到文件。
theano/sandbox/gpuarray/opt.py
浏览文件 @
d479efa7
...
@@ -464,6 +464,7 @@ def local_gpu_pdbbreakpoint_op(node):
...
@@ -464,6 +464,7 @@ def local_gpu_pdbbreakpoint_op(node):
input_is_from_gpu
=
(
inp
.
owner
and
input_is_from_gpu
=
(
inp
.
owner
and
isinstance
(
inp
.
owner
.
op
,
HostFromGpu
))
isinstance
(
inp
.
owner
.
op
,
HostFromGpu
))
output_goes_to_gpu
=
False
for
c
in
out
.
clients
:
for
c
in
out
.
clients
:
if
c
==
'output'
:
if
c
==
'output'
:
continue
continue
...
...
theano/sandbox/gpuarray/tests/test_opt.py
浏览文件 @
d479efa7
...
@@ -9,13 +9,12 @@ from theano.tensor.tests import test_basic
...
@@ -9,13 +9,12 @@ from theano.tensor.tests import test_basic
import
theano.sandbox.gpuarray
import
theano.sandbox.gpuarray
from
..
import
basic_ops
from
..
import
basic_ops
from
..type
import
GpuArrayType
,
gpuarray_shared_constructor
from
..type
import
GpuArrayType
,
gpuarray_shared_constructor
,
get_context
from
..basic_ops
import
(
GpuAlloc
,
GpuReshape
,
gpu_alloc
,
from
..basic_ops
import
GpuAlloc
,
GpuReshape
,
GpuFromHost
,
host_from_gpu
gpu_from_host
,
host_from_gpu
)
from
..elemwise
import
GpuCAReduceCuda
,
GpuCAReduceCPY
,
GpuElemwise
from
..elemwise
import
GpuCAReduceCuda
,
GpuCAReduceCPY
,
GpuElemwise
from
..subtensor
import
GpuSubtensor
from
..subtensor
import
GpuSubtensor
from
.config
import
mode_with_gpu
,
mode_without_gpu
from
.config
import
mode_with_gpu
,
mode_without_gpu
,
test_ctx_name
from
.test_basic_ops
import
rand_gpuarray
from
.test_basic_ops
import
rand_gpuarray
...
@@ -99,7 +98,7 @@ def test_flatten():
...
@@ -99,7 +98,7 @@ def test_flatten():
def
test_reduce
():
def
test_reduce
():
dev
=
theano
.
sandbox
.
gpuarray
.
init_dev
.
device
kind
=
get_context
(
test_ctx_name
)
.
kind
for
method
,
param
in
[(
'sum'
,
dict
(
acc_dtype
=
'float32'
)),
for
method
,
param
in
[(
'sum'
,
dict
(
acc_dtype
=
'float32'
)),
(
'prod'
,
dict
(
acc_dtype
=
'float32'
)),
(
'prod'
,
dict
(
acc_dtype
=
'float32'
)),
...
@@ -115,7 +114,7 @@ def test_reduce():
...
@@ -115,7 +114,7 @@ def test_reduce():
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
ops
=
[
type
(
node
.
op
)
for
node
in
topo
]
ops
=
[
type
(
node
.
op
)
for
node
in
topo
]
if
dev
.
startswith
(
'opencl'
)
and
method
in
[
"max"
,
"min"
]:
if
kind
==
'opencl'
and
method
in
[
"max"
,
"min"
]:
assert
not
(
GpuCAReduceCuda
in
ops
or
GpuCAReduceCPY
in
ops
)
assert
not
(
GpuCAReduceCuda
in
ops
or
GpuCAReduceCPY
in
ops
)
else
:
else
:
assert
GpuCAReduceCuda
in
ops
or
GpuCAReduceCPY
in
ops
assert
GpuCAReduceCuda
in
ops
or
GpuCAReduceCPY
in
ops
...
@@ -128,7 +127,7 @@ def test_local_gpualloc_memset_0():
...
@@ -128,7 +127,7 @@ def test_local_gpualloc_memset_0():
ones
=
numpy
.
ones
((
2
,),
dtype
=
'float32'
)
ones
=
numpy
.
ones
((
2
,),
dtype
=
'float32'
)
# Test with 0
# Test with 0
a
=
gpu_alloc
(
z
,
i
)
a
=
GpuAlloc
(
test_ctx_name
)
(
z
,
i
)
f
=
theano
.
function
([
i
],
a
,
mode
=
mode_with_gpu
)
f
=
theano
.
function
([
i
],
a
,
mode
=
mode_with_gpu
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
assert
len
(
topo
)
==
1
assert
len
(
topo
)
==
1
...
@@ -136,7 +135,7 @@ def test_local_gpualloc_memset_0():
...
@@ -136,7 +135,7 @@ def test_local_gpualloc_memset_0():
assert
(
numpy
.
asarray
(
f
(
6
))
==
0
)
.
all
()
assert
(
numpy
.
asarray
(
f
(
6
))
==
0
)
.
all
()
# Test with 1
# Test with 1
a
=
gpu_alloc
(
o
,
i
)
a
=
GpuAlloc
(
test_ctx_name
)
(
o
,
i
)
f
=
theano
.
function
([
i
],
a
,
mode
=
mode_with_gpu
)
f
=
theano
.
function
([
i
],
a
,
mode
=
mode_with_gpu
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
assert
len
(
topo
)
==
1
assert
len
(
topo
)
==
1
...
@@ -145,7 +144,7 @@ def test_local_gpualloc_memset_0():
...
@@ -145,7 +144,7 @@ def test_local_gpualloc_memset_0():
assert
(
numpy
.
asarray
(
f
(
6
))
==
1
)
.
all
()
assert
(
numpy
.
asarray
(
f
(
6
))
==
1
)
.
all
()
# Test with 1, 1
# Test with 1, 1
a
=
gpu_alloc
(
ones
,
i
)
a
=
GpuAlloc
(
test_ctx_name
)
(
ones
,
i
)
f
=
theano
.
function
([
i
],
a
,
mode
=
mode_with_gpu
)
f
=
theano
.
function
([
i
],
a
,
mode
=
mode_with_gpu
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
assert
len
(
topo
)
==
1
assert
len
(
topo
)
==
1
...
@@ -182,7 +181,7 @@ def test_print_op():
...
@@ -182,7 +181,7 @@ def test_print_op():
f
=
theano
.
function
([
b
],
theano
.
printing
.
Print
()(
b
)
*
2
,
f
=
theano
.
function
([
b
],
theano
.
printing
.
Print
()(
b
)
*
2
,
mode
=
mode_with_gpu
)
mode
=
mode_with_gpu
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
assert
topo
[
0
]
.
op
==
gpu_from_host
assert
isinstance
(
topo
[
0
]
.
op
,
GpuFromHost
)
assert
isinstance
(
topo
[
1
]
.
op
,
theano
.
printing
.
Print
)
assert
isinstance
(
topo
[
1
]
.
op
,
theano
.
printing
.
Print
)
assert
isinstance
(
topo
[
2
]
.
op
,
GpuElemwise
)
assert
isinstance
(
topo
[
2
]
.
op
,
GpuElemwise
)
assert
topo
[
3
]
.
op
==
host_from_gpu
assert
topo
[
3
]
.
op
==
host_from_gpu
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论