Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
7fbb1e3b
提交
7fbb1e3b
authored
2月 24, 2011
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make a white list of dtype supported on the gpu and not a blacklist.
This make that we now don't support complex* on the gpu as they where not blacklisted.
上级
c007e003
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
13 行增加
和
8 行删除
+13
-8
opt.py
theano/sandbox/cuda/opt.py
+13
-8
没有找到文件。
theano/sandbox/cuda/opt.py
浏览文件 @
7fbb1e3b
...
...
@@ -99,12 +99,16 @@ gpu_cut_copies.register('cut_gpu_constant_transfers', tensor.opt.constant_foldin
#botering with this useless pattern.
compile
.
optdb
[
'canonicalize'
]
.
register
(
'local_cut_gpu_host_gpu'
,
local_cut_gpu_host_gpu
,
'fast_run'
)
def
float64_in_elemwise
(
op
):
#'float64', 'complex128' and 'complex64' are not supported in elemwise on the gpu.
elemwise_cuda_dtype_supported
=
[
'float32'
,
'uint8'
,
'int8'
,
'uint16'
,
'int16'
,
'uint32'
,
'int32''uint64'
,
'int64'
]
def
dtype_in_elemwise_supported
(
op
):
"""
Return True of the Elemwise op
have float64 in it
.
Return True of the Elemwise op
is supported on the gpu
.
Return False otherwise.
:note:
This can happen with the Composite O
p.
:note:
We need to check inside the Composite o
p.
"""
def
get_all_basic_scalar
(
composite_op
):
l
=
[]
...
...
@@ -118,9 +122,10 @@ def float64_in_elemwise(op):
if
isinstance
(
op
.
scalar_op
,
theano
.
scalar
.
Composite
):
scals
=
get_all_basic_scalar
(
op
.
scalar_op
)
for
s
in
scals
:
if
any
([
i
.
type
.
dtype
==
'float64'
for
i
in
s
.
inputs
+
s
.
outputs
]):
return
True
return
False
if
any
([
i
.
type
.
dtype
not
in
elemwise_cuda_dtype_supported
for
i
in
s
.
inputs
+
s
.
outputs
]):
return
False
return
True
...
...
@@ -131,7 +136,7 @@ def local_gpu_elemwise_0(node):
"""elemwise(..., host_from_gpu, ...)
-> host_from_gpu(elemwise(gpu_from_host, ..., gpu_from_host)
"""
if
isinstance
(
node
.
op
,
tensor
.
Elemwise
)
and
not
float64_in_elemwise
(
node
.
op
):
if
isinstance
(
node
.
op
,
tensor
.
Elemwise
)
and
dtype_in_elemwise_supported
(
node
.
op
):
if
numpy
.
any
([
i
.
owner
and
isinstance
(
i
.
owner
.
op
,
HostFromGpu
)
for
i
in
node
.
inputs
]):
if
numpy
.
all
([
o
.
type
.
dtype
==
'float32'
for
o
in
node
.
outputs
]):
#don't set any inplace pattern. gpu_insert_inplace_optimizer will do it later
...
...
@@ -174,7 +179,7 @@ def local_gpu_elemwise_1(node):
if
(
host_i
.
owner
and
isinstance
(
host_i
.
owner
.
op
,
tensor
.
Elemwise
)
and
len
(
host_i
.
clients
)
==
1
and
not
float64_in_elemwise
(
node
.
op
)):
dtype_in_elemwise_supported
(
node
.
op
)):
elemwise_node
=
host_i
.
owner
#don't set any inplace pattern. gpu_insert_inplace_optimizer will do it later
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论