Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
45f18bad
提交
45f18bad
authored
8月 11, 2015
作者:
Iban Harlouchet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
numpydoc for theano/sandbox/gpuarray/conv.py
上级
acebecd7
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
45 行增加
和
38 行删除
+45
-38
conv.py
theano/sandbox/gpuarray/conv.py
+45
-38
没有找到文件。
theano/sandbox/gpuarray/conv.py
浏览文件 @
45f18bad
...
@@ -12,7 +12,48 @@ from .basic_ops import as_gpuarray_variable
...
@@ -12,7 +12,48 @@ from .basic_ops import as_gpuarray_variable
class
GpuConv
(
gof
.
Op
):
class
GpuConv
(
gof
.
Op
):
"""
"""
Implement the batched and stacked 2d convolution on the gpu.
Implement the batched and stacked 2d convolution on the gpu.
Parameters
----------
version
Each version of c_code implements many kernels for the convolution.
By default we try to guess the best one. You can force one version with
this parameter. This parameter is used by the tests.
direction_hint
'forward', 'bprop weights' or 'bprop inputs'. Serves as a hint for graph
optimizers replacing GpuConv by other implementations. If the GpuConv is
inserted automatically, we take its value from ConvOp.
verbose
For value of 1,2 and 3. Print more information during the execution of
the convolution. Mostly used for optimization or debugging.
kshp
The size of the kernel. If provided, can generate faster code. If the
GpuConv op is automatically inserted, we take its value automatically
from the Conv op.
imshp
The size of the image. Not used for code generation but allows to select
an experimental new version in another repo.
max_threads_dim0
The maximum number of threads for the block size dimensions 0
(blockDim.x) used by the GPU function.
nkern
The number of kernels. Not used for this op, but can be used by graph
optimizers to select a more optimal convolution implementation. If the
GpuConv op is inserted automatically, we take its value from the Conv
op.
bsize
The batch size. Not used for this op, but can be used by graph
optimizers to select a more optimal convolution implementation. If the
GpuConv op is inserted automatically, we take its value from the Conv
op.
fft_opt
Deactivate fft_opt optimization at the op level when set to False. Note
that by default fft optimization aren't enabled.
See :ref:`convolution documentation <libdoc_tensor_nnet_conv>` to enable
them.
"""
"""
@staticmethod
@staticmethod
def
logical_output_shape_2d
(
imshp
,
kshp
,
mode
):
def
logical_output_shape_2d
(
imshp
,
kshp
,
mode
):
if
mode
==
'valid'
:
if
mode
==
'valid'
:
...
@@ -35,43 +76,6 @@ class GpuConv(gof.Op):
...
@@ -35,43 +76,6 @@ class GpuConv(gof.Op):
nkern
=
None
,
nkern
=
None
,
bsize
=
None
,
bsize
=
None
,
fft_opt
=
True
):
fft_opt
=
True
):
"""
:param version: each version of c_code implements many kernels for the
convolution. By default we try to guess the best one.
You can force one version with this parameter. This
parameter is used by the tests.
:param direction_hint: 'forward', 'bprop weights' or 'bprop inputs'.
Serves as a hint for graph optimizers replacing
GpuConv by other implementations. If the GpuConv is
inserted automatically, we take its value from ConvOp.
:param verbose: for value of 1,2 and 3. Print more information during
the execution of the convolution. Mostly used for
optimization or debugging.
:param kshp: The size of the kernel. If provided, can generate
faster code. If the GpuConv op is automatically
inserted,
we take its value automatically from the Conv op.
:param imshp: The size of the image. Not used for code generation but
allows to select an experimental new version in another
repo.
:param max_threads_dim0: The maximum number of threads for the
block size dimensions 0 (blockDim.x) used by the
GPU function.
:param nkern: The number of kernels. Not used for this op, but can be
used by graph optimizers to select a more optimal
convolution implementation. If the GpuConv op is inserted
automatically, we take its value from the Conv op.
:param bsize: The batch size. Not used for this op, but can be
used by graph optimizers to select a more optimal
convolution implementation. If the GpuConv op is inserted
automatically, we take its value from the Conv op.
:param fft_opt: deactivate fft_opt optimization at the op level when
set to False. Note that by default fft optimization
aren't enabled. See
:ref:`convolution documentation <libdoc_tensor_nnet_conv>`
to enable them.
"""
self
.
border_mode
=
border_mode
self
.
border_mode
=
border_mode
self
.
subsample
=
subsample
self
.
subsample
=
subsample
if
logical_img_hw
is
not
None
:
if
logical_img_hw
is
not
None
:
...
@@ -169,7 +173,10 @@ class GpuConv(gof.Op):
...
@@ -169,7 +173,10 @@ class GpuConv(gof.Op):
return
gof
.
Apply
(
self
,
[
img
,
kern
],
[
out
])
return
gof
.
Apply
(
self
,
[
img
,
kern
],
[
out
])
def
flops
(
self
,
inputs
,
outputs
):
def
flops
(
self
,
inputs
,
outputs
):
""" Useful with the hack in profilemode to print the MFlops"""
"""
Useful with the hack in profilemode to print the MFlops.
"""
images
,
kerns
=
inputs
images
,
kerns
=
inputs
out
,
=
outputs
out
,
=
outputs
assert
images
[
1
]
==
kerns
[
1
]
assert
images
[
1
]
==
kerns
[
1
]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论