Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0851aa69
提交
0851aa69
authored
6月 02, 2016
作者:
sentient07
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pre-instantiating GPUOps
上级
c9f47bd5
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
33 行增加
和
16 行删除
+33
-16
opt.py
theano/gpuarray/opt.py
+33
-16
没有找到文件。
theano/gpuarray/opt.py
浏览文件 @
0851aa69
...
...
@@ -33,12 +33,16 @@ from .basic_ops import (as_gpuarray_variable, infer_context_name,
GpuSplit
,
GpuContiguous
,
gpu_contiguous
,
GpuAlloc
,
GpuAllocEmpty
,
GpuReshape
,
GpuEye
,
gpu_join
,
GpuJoin
)
from
.blas
import
(
gpu_dot22
,
GpuGemv
,
GpuGemm
,
GpuGer
,
GpuGemmBatch
,
gpugemm_no_inplace
,
gpugemmbatch_no_inplace
)
from
.blocksparse
import
GpuSparseBlockGemv
,
GpuSparseBlockOuter
from
.nnet
import
(
GpuCrossentropySoftmaxArgmax1HotWithBias
,
GpuCrossentropySoftmax1HotWithBiasDx
,
GpuSoftmaxWithBias
,
GpuSoftmax
)
from
.blas
import
(
gpu_dot22
,
GpuGemm
,
GpuGer
,
GpuGemmBatch
,
gpugemm_no_inplace
,
gpugemm_inplace
,
gpugemmbatch_no_inplace
,
gpugemv_no_inplace
,
gpugemv_inplace
)
from
.blocksparse
import
(
GpuSparseBlockGemv
,
GpuSparseBlockOuter
,
gpu_sparse_block_outer
,
gpu_sparse_block_outer_inplace
,
gpu_sparse_block_gemv
,
gpu_sparse_block_gemv_inplace
)
from
.nnet
import
(
gpu_crossentropy_softmax_1hot_with_bias_dx
,
gpu_crossentropy_softmax_argmax_1hot_with_bias
,
gpu_softmax_with_bias
,
gpu_softmax
)
from
.elemwise
import
(
GpuElemwise
,
GpuDimShuffle
,
GpuCAReduceCuda
,
GpuCAReduceCPY
)
from
.subtensor
import
(
GpuIncSubtensor
,
GpuSubtensor
,
...
...
@@ -49,6 +53,7 @@ from .opt_util import alpha_merge, output_merge
_logger
=
logging
.
getLogger
(
"theano.gpuarray.opt"
)
gpu_optimizer
=
EquilibriumDB
()
gpu_cut_copies
=
EquilibriumDB
()
...
...
@@ -754,13 +759,19 @@ def local_gpua_careduce(node, context_name):
@register_opt
(
'fast_compile'
)
@op_lifter
([
tensor
.
blas
.
Gemv
,
tensor
.
blas_c
.
CGemv
])
def
local_gpua_gemv
(
node
,
context_name
):
return
GpuGemv
(
inplace
=
node
.
op
.
inplace
)
if
node
.
op
.
inplace
:
return
gpugemv_inplace
else
:
return
gpugemv_no_inplace
@register_opt
(
'fast_compile'
)
@op_lifter
([
tensor
.
blas
.
Gemm
])
def
local_gpua_gemm
(
node
,
context_name
):
return
GpuGemm
(
inplace
=
node
.
op
.
inplace
)
if
node
.
op
.
inplace
:
return
gpugemm_inplace
else
:
return
gpugemm_no_inplace
@register_opt
(
'fast_compile'
)
...
...
@@ -834,7 +845,7 @@ def local_gpua_dot22scalar(node, context_name):
x
=
as_gpuarray_variable
(
x
,
context_name
)
y
=
as_gpuarray_variable
(
y
,
context_name
)
z
=
GpuAllocEmpty
(
x
.
dtype
,
context_name
)(
x
.
shape
[
0
],
y
.
shape
[
1
])
return
[
GpuGemm
(
inplace
=
False
)
(
z
,
a
,
x
,
y
,
0
)]
return
[
gpugemm_no_inplace
(
z
,
a
,
x
,
y
,
0
)]
@register_opt
(
'fast_compile'
)
...
...
@@ -846,25 +857,25 @@ def local_gpua_eye(node, context_name):
@register_opt
(
'fast_compile'
)
@op_lifter
([
tensor
.
nnet
.
CrossentropySoftmaxArgmax1HotWithBias
],
cuda_only
=
True
)
def
local_gpua_crossentropysoftmaxargmax1hotwithbias
(
node
,
context_name
):
return
GpuCrossentropySoftmaxArgmax1HotWithBias
()
return
gpu_crossentropy_softmax_argmax_1hot_with_bias
@register_opt
(
'fast_compile'
)
@op_lifter
([
tensor
.
nnet
.
CrossentropySoftmax1HotWithBiasDx
],
cuda_only
=
True
)
def
local_gpua_crossentropysoftmax1hotwithbiasdx
(
node
,
context_name
):
return
GpuCrossentropySoftmax1HotWithBiasDx
()
return
gpu_crossentropy_softmax_1hot_with_bias_dx
@register_opt
(
'fast_compile'
)
@op_lifter
([
tensor
.
nnet
.
Softmax
],
cuda_only
=
True
)
def
local_gpua_softmax
(
node
,
context_name
):
return
GpuSoftmax
()
return
gpu_softmax
@register_opt
(
'fast_compile'
)
@op_lifter
([
tensor
.
nnet
.
SoftmaxWithBias
],
cuda_only
=
True
)
def
local_gpua_softmaxwithbias
(
node
,
context_name
):
return
GpuSoftmaxWithBias
()
return
gpu_softmax_with_bias
@register_opt
(
'fast_compile'
)
...
...
@@ -889,20 +900,26 @@ theano.tensor.nnet.conv2d()
@register_opt
(
'fast_compile'
)
@op_lifter
([
SparseBlockGemv
])
def
local_lift_sparseblockgemv
(
node
,
context_name
):
return
GpuSparseBlockGemv
(
node
.
op
.
inplace
)
if
node
.
op
.
inplace
:
return
gpu_sparse_block_gemv_inplace
else
:
return
gpu_sparse_block_gemv
@register_opt
(
'fast_compile'
)
@op_lifter
([
SparseBlockOuter
])
def
local_lift_sparseblockouter
(
node
,
context_name
):
return
GpuSparseBlockOuter
(
node
.
op
.
inplace
)
if
node
.
op
.
inplace
:
return
gpu_sparse_block_outer_inplace
else
:
return
gpu_sparse_block_outer
@register_inplace
()
@local_optimizer
([
GpuSparseBlockGemv
],
inplace
=
True
)
def
local_inplace_sparseblockgemv
(
node
):
if
isinstance
(
node
.
op
,
GpuSparseBlockGemv
)
and
not
node
.
op
.
inplace
:
return
[
GpuSparseBlockGemv
(
inplace
=
True
)
(
*
node
.
inputs
)]
return
[
gpu_sparse_block_gemv_inplace
(
*
node
.
inputs
)]
@register_inplace
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论