Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ca0b81d9
提交
ca0b81d9
authored
11月 01, 2011
作者:
James Bergstra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gpu Elemwise uses custom exception SupportCodeError
上级
87d414e4
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
8 行增加
和
5 行删除
+8
-5
elemwise.py
theano/sandbox/cuda/elemwise.py
+5
-3
opt.py
theano/sandbox/cuda/opt.py
+3
-2
没有找到文件。
theano/sandbox/cuda/elemwise.py
浏览文件 @
ca0b81d9
...
@@ -28,6 +28,10 @@ def get_str_list_logical_scalar(node, value_str='ii_i%i_value', data_str='ii_i%i
...
@@ -28,6 +28,10 @@ def get_str_list_logical_scalar(node, value_str='ii_i%i_value', data_str='ii_i%i
else
:
l
+=
[
data_str
%
ipos
]
else
:
l
+=
[
data_str
%
ipos
]
return
l
return
l
class
SupportCodeError
(
Exception
):
"""It is currently not possible to auto-generate a GPU implementation for
an elementwise Op with support code."""
class
NaiveAlgo
(
object
):
class
NaiveAlgo
(
object
):
verbose
=
0
# 1, 2 or 3 for more verbose output.
verbose
=
0
# 1, 2 or 3 for more verbose output.
cache_version
=
()
cache_version
=
()
...
@@ -39,9 +43,7 @@ class NaiveAlgo(object):
...
@@ -39,9 +43,7 @@ class NaiveAlgo(object):
:param sync: if True, will wait after the kernel launch and check for error call.
:param sync: if True, will wait after the kernel launch and check for error call.
"""
"""
if
scalar_op
.
c_support_code_apply
(
node
=
None
,
nodename
=
"nodename"
):
if
scalar_op
.
c_support_code_apply
(
node
=
None
,
nodename
=
"nodename"
):
raise
ValueError
((
'It is currently not possible to auto-generate'
raise
SupportCodeError
(
scalar_op
)
' a GPU implementation for an elementwise Op with support'
' code'
),
scalar_op
)
self
.
scalar_op
=
scalar_op
self
.
scalar_op
=
scalar_op
self
.
sync
=
sync
self
.
sync
=
sync
self
.
inplace_pattern
=
inplace_pattern
self
.
inplace_pattern
=
inplace_pattern
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
ca0b81d9
...
@@ -22,6 +22,7 @@ from theano.sandbox.cuda.nnet import (
...
@@ -22,6 +22,7 @@ from theano.sandbox.cuda.nnet import (
GpuCrossentropySoftmaxArgmax1HotWithBias
,
GpuCrossentropySoftmaxArgmax1HotWithBias
,
GpuCrossentropySoftmax1HotWithBiasDx
,
GpuCrossentropySoftmax1HotWithBiasDx
,
GpuSoftmax
,
GpuSoftmaxWithBias
)
GpuSoftmax
,
GpuSoftmaxWithBias
)
from
theano.sandbox.cuda.elemwise
import
SupportCodeError
from
theano.compile
import
optdb
from
theano.compile
import
optdb
from
theano.tensor.blas
import
_is_real_vector
,
_is_real_matrix
from
theano.tensor.blas
import
_is_real_vector
,
_is_real_matrix
...
@@ -146,7 +147,7 @@ def local_gpu_elemwise_0(node):
...
@@ -146,7 +147,7 @@ def local_gpu_elemwise_0(node):
# gpu_inplace_elemwise_optimizer will do it later
# gpu_inplace_elemwise_optimizer will do it later
try
:
try
:
new_op
=
GpuElemwise
(
node
.
op
.
scalar_op
)
new_op
=
GpuElemwise
(
node
.
op
.
scalar_op
)
except
Valu
eError
:
except
SupportCod
eError
:
# This happens when scalar_op requires support code
# This happens when scalar_op requires support code
return
False
return
False
...
@@ -194,7 +195,7 @@ def local_gpu_elemwise_1(node):
...
@@ -194,7 +195,7 @@ def local_gpu_elemwise_1(node):
# gpu_inplace_elemwise_optimizer will do it later
# gpu_inplace_elemwise_optimizer will do it later
try
:
try
:
new_op
=
GpuElemwise
(
elemwise_node
.
op
.
scalar_op
)
new_op
=
GpuElemwise
(
elemwise_node
.
op
.
scalar_op
)
except
Valu
eError
:
except
SupportCod
eError
:
# This happens when scalar_op requires support code
# This happens when scalar_op requires support code
return
False
return
False
if
all
([
i
.
dtype
==
'float32'
for
i
in
elemwise_node
.
inputs
]):
if
all
([
i
.
dtype
==
'float32'
for
i
in
elemwise_node
.
inputs
]):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论