Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
2fb55a4c
提交
2fb55a4c
authored
3月 20, 2014
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1776 from nouiz/32bit
Fix cuda test on 32 bit python.
上级
95bf6e34
02d59ba7
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
17 行增加
和
7 行删除
+17
-7
test_opt.py
theano/sandbox/cuda/tests/test_opt.py
+17
-7
没有找到文件。
theano/sandbox/cuda/tests/test_opt.py
浏览文件 @
2fb55a4c
import
operator
import
sys
import
sys
import
numpy
import
numpy
...
@@ -213,20 +214,29 @@ def test_huge_elemwise_fusion():
...
@@ -213,20 +214,29 @@ def test_huge_elemwise_fusion():
"""
"""
shape
=
(
2
,
3
,
4
,
5
,
6
)
shape
=
(
2
,
3
,
4
,
5
,
6
)
ttype
=
tensor
.
tensor
(
dtype
=
'float32'
,
broadcastable
=
(
False
,)
*
len
(
shape
))
ttype
=
tensor
.
tensor
(
dtype
=
'float32'
,
broadcastable
=
(
False
,)
*
len
(
shape
))
vars
=
[
tensor
.
tanh
(
ttype
)
for
x
in
range
(
7
)]
gpu_ptr_size
=
theano
.
sandbox
.
cuda
.
opt
.
get_device_type_sizes
()[
'gpu_ptr_size'
]
f
=
pfunc
(
vars
,
[
vars
[
0
]
-
vars
[
1
]
-
vars
[
2
]
-
vars
[
3
]
-
vars
[
4
]
-
if
gpu_ptr_size
==
8
:
vars
[
5
]
-
vars
[
6
]],
mode
=
mode_with_gpu
)
nb_in
=
7
len_topo
=
10
elif
gpu_ptr_size
==
4
:
nb_in
=
8
len_topo
=
11
else
:
raise
Exception
(
"Unexpected value for gpu_ptr_size"
,
gpu_ptr_size
)
vars
=
[
tensor
.
tanh
(
ttype
)
for
x
in
range
(
nb_in
)]
f
=
pfunc
(
vars
,
[
reduce
(
operator
.
sub
,
vars
)],
mode
=
mode_with_gpu
)
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
#theano.printing.debugprint(f)
#theano.printing.debugprint(f)
#for i, node in enumerate(topo):
#for i, node in enumerate(topo):
# print >> sys.stdout, i, node
# print >> sys.stdout, i, node
assert
len
(
topo
)
==
10
assert
len
(
topo
)
==
len_topo
assert
sum
([
isinstance
(
node
.
op
,
cuda
.
GpuElemwise
)
for
node
in
topo
])
==
2
assert
sum
([
isinstance
(
node
.
op
,
cuda
.
GpuElemwise
)
for
node
in
topo
])
==
2
assert
isinstance
(
topo
[
7
]
.
op
.
scalar_op
,
theano
.
scalar
.
basic
.
Sub
)
assert
isinstance
(
topo
[
-
3
]
.
op
.
scalar_op
,
theano
.
scalar
.
basic
.
Sub
)
assert
isinstance
(
topo
[
8
]
.
op
.
scalar_op
,
theano
.
scalar
.
basic
.
Composite
)
assert
isinstance
(
topo
[
-
2
]
.
op
.
scalar_op
,
theano
.
scalar
.
basic
.
Composite
)
#let debugmode catch errors
#let debugmode catch errors
gen
=
lambda
:
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float32'
)
gen
=
lambda
:
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
shape
),
dtype
=
'float32'
)
f
(
gen
(),
gen
(),
gen
(),
gen
(),
gen
(),
gen
(),
gen
()
)
f
(
*
[
gen
()
for
i
in
range
(
nb_in
)]
)
# Test the case where we can't put the computation on the gpu! their is too
# Test the case where we can't put the computation on the gpu! their is too
# many dimensions to the input to have 2 inputs to the op!
# many dimensions to the input to have 2 inputs to the op!
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论