Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
2827eb57
提交
2827eb57
authored
6月 22, 2015
作者:
--global
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add opt for Dnn LogSoftmax
上级
371fe991
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
22 行增加
和
2 行删除
+22
-2
dnn.py
theano/sandbox/cuda/dnn.py
+22
-2
没有找到文件。
theano/sandbox/cuda/dnn.py
浏览文件 @
2827eb57
...
@@ -3,7 +3,7 @@ import numpy
...
@@ -3,7 +3,7 @@ import numpy
import
theano
import
theano
from
theano
import
Apply
,
gof
,
tensor
,
config
,
Variable
from
theano
import
Apply
,
gof
,
tensor
,
config
,
Variable
from
theano.scalar
import
as_scalar
,
constant
from
theano.scalar
import
as_scalar
,
constant
,
Log
from
theano.gradient
import
DisconnectedType
,
grad_not_implemented
from
theano.gradient
import
DisconnectedType
,
grad_not_implemented
from
theano.gof
import
Optimizer
,
local_optimizer
,
COp
from
theano.gof
import
Optimizer
,
local_optimizer
,
COp
from
theano.gof.type
import
CDataType
,
Generic
from
theano.gof.type
import
CDataType
,
Generic
...
@@ -17,7 +17,8 @@ from theano.sandbox.cuda import GpuOp
...
@@ -17,7 +17,8 @@ from theano.sandbox.cuda import GpuOp
from
theano.sandbox.cuda.basic_ops
import
(
as_cuda_ndarray_variable
,
from
theano.sandbox.cuda.basic_ops
import
(
as_cuda_ndarray_variable
,
host_from_gpu
,
host_from_gpu
,
gpu_contiguous
,
HostFromGpu
,
gpu_contiguous
,
HostFromGpu
,
gpu_alloc_empty
,
GpuAllocEmpty
)
gpu_alloc_empty
,
GpuAllocEmpty
,
GpuElemwise
)
from
theano.sandbox.cuda.blas
import
(
GpuConv
,
GpuDownsampleFactorMax
,
from
theano.sandbox.cuda.blas
import
(
GpuConv
,
GpuDownsampleFactorMax
,
GpuDownsampleFactorMaxGrad
)
GpuDownsampleFactorMaxGrad
)
from
theano.sandbox.cuda.nnet
import
GpuSoftmax
from
theano.sandbox.cuda.nnet
import
GpuSoftmax
...
@@ -2247,6 +2248,25 @@ if True:
...
@@ -2247,6 +2248,25 @@ if True:
out
=
as_cuda_ndarray_variable
(
out
.
dimshuffle
(
0
,
1
))
out
=
as_cuda_ndarray_variable
(
out
.
dimshuffle
(
0
,
1
))
return
[
out
]
return
[
out
]
@register_opt
(
'cudnn'
)
@local_optimizer
([
GpuElemwise
])
def
local_log_softmax_dnn
(
node
):
if
not
dnn_available
():
return
if
(
isinstance
(
node
.
op
,
GpuElemwise
)
and
isinstance
(
node
.
op
.
scalar_op
,
Log
)
and
node
.
inputs
[
0
]
.
owner
and
isinstance
(
node
.
inputs
[
0
]
.
owner
.
op
,
GpuDnnSoftmax
)
and
len
(
node
.
inputs
[
0
]
.
owner
.
out
.
clients
)
==
1
):
log_input
=
node
.
inputs
[
0
]
softmax_node
=
log_input
.
owner
new_softmax_node
=
GpuDnnSoftmax
(
softmax_node
.
op
.
tensor_format
,
'log'
,
softmax_node
.
op
.
mode
)
new_log_softmax
=
new_softmax_node
(
softmax_node
.
inputs
[
0
])
return
[
new_log_softmax
]
class
NoCuDNNRaise
(
Optimizer
):
class
NoCuDNNRaise
(
Optimizer
):
def
apply
(
self
,
fgraph
):
def
apply
(
self
,
fgraph
):
""" Raise a RuntimeError if cudnn can't be used"""
""" Raise a RuntimeError if cudnn can't be used"""
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论