提交 90c8f80b authored 作者: Nicolas Ballas's avatar Nicolas Ballas

update doc

上级 77729ffa
...@@ -31,11 +31,15 @@ ...@@ -31,11 +31,15 @@
that will be replaced by an actual convolution implementation during that will be replaced by an actual convolution implementation during
the optimization phase. the optimization phase.
Since the abstract Op does not have any implementation, it will prevent
computations in the un-optimized graph, and cause problems with DebugMode,
test values, and when compiling with optimizer=None.
By default, if :ref:`cuDNN <libdoc_cuda_dnn>` By default, if :ref:`cuDNN <libdoc_cuda_dnn>`
is available, we will use it, otherwise we will fall back to using the is available, we will use it, otherwise we will fall back to using the
gemm version (slower then cuDNN in most cases and uses more memory). gemm version (slower then cuDNN in most cases and uses more memory).
Both cuDNN and the gemm version can be disabled using the Theano flags Either cuDNN and the gemm version can be disabled using the Theano flags
``optimizer_excluding=conv_dnn`` and ``optimizer_excluding=conv_gemm``, ``optimizer_excluding=conv_dnn`` and ``optimizer_excluding=conv_gemm``,
respectively. In this case, we will fall back to using the legacy respectively. In this case, we will fall back to using the legacy
convolution code, which is slower, but does not require extra memory. convolution code, which is slower, but does not require extra memory.
......
...@@ -43,30 +43,33 @@ def conv2d(input, filters, input_shape=None, filter_shape=None, ...@@ -43,30 +43,33 @@ def conv2d(input, filters, input_shape=None, filter_shape=None,
stack of 2D inputs with a set of 2D filters. The implementation is modelled stack of 2D inputs with a set of 2D filters. The implementation is modelled
after Convolutional Neural Networks (CNN). after Convolutional Neural Networks (CNN).
:type input: symbolic 4D tensor
:param input: mini-batch of feature map stacks, of shape Parameters
----------
input: symbolic 4D tensor
Mini-batch of feature map stacks, of shape
(batch size, input channels, input rows, input columns). (batch size, input channels, input rows, input columns).
See the optional parameter ``input_shape``. See the optional parameter ``input_shape``.
:type filters: symbolic 4D tensor filters: symbolic 4D tensor
:param filters: set of filters used in CNN layer of shape Set of filters used in CNN layer of shape
(output channels, input channels, filter rows, filter columns). (output channels, input channels, filter rows, filter columns).
See the optional parameter ``filter_shape``. See the optional parameter ``filter_shape``.
:type input_shape: None, tuple/list of len 4 of int or Constant variable input_shape: None, tuple/list of len 4 of int or Constant variable
:param input_shape: The shape of the input parameter. The shape of the input parameter.
Optional, possibly used to choose an optimal implementation. Optional, possibly used to choose an optimal implementation.
You can give ``None`` for any element of the list to specify that this You can give ``None`` for any element of the list to specify that this
element is not known at compile time. element is not known at compile time.
:type filter_shape: None, tuple/list of len 4 of int or Constant variable filter_shape: None, tuple/list of len 4 of int or Constant variable
:param filter_shape: The shape of the filters parameter. The shape of the filters parameter.
Optional, possibly used to choose an optimal implementation. Optional, possibly used to choose an optimal implementation.
You can give ``None`` for any element of the list to specify that this You can give ``None`` for any element of the list to specify that this
element is not known at compile time. element is not known at compile time.
:type border_mode: str, int or tuple of two int border_mode: str, int or tuple of two int
:param border_mode: Either of the following: Either of the following:
``'valid'``: apply filter wherever it completely overlaps with the ``'valid'``: apply filter wherever it completely overlaps with the
input. Generates output of shape: input shape - filter shape + 1 input. Generates output of shape: input shape - filter shape + 1
...@@ -81,31 +84,35 @@ def conv2d(input, filters, input_shape=None, filter_shape=None, ...@@ -81,31 +84,35 @@ def conv2d(input, filters, input_shape=None, filter_shape=None,
``(int1, int2)``: pad input with a symmetric border of ``int1`` rows ``(int1, int2)``: pad input with a symmetric border of ``int1`` rows
and ``int2`` columns, then perform a valid convolution. and ``int2`` columns, then perform a valid convolution.
:type subsample: tuple of len 2 subsample: tuple of len 2
:param subsample: factor by which to subsample the output. Factor by which to subsample the output.
Also called strides elsewhere. Also called strides elsewhere.
:type filter_flip: bool filter_flip: bool
:param filter_flip: If ``True``, will flip the filter rows and columns If ``True``, will flip the filter rows and columns
before sliding them over the input. This operation is normally referred before sliding them over the input. This operation is normally referred
to as a convolution, and this is the default. If ``False``, the filters to as a convolution, and this is the default. If ``False``, the filters
are not flipped and the operation is referred to as a cross-correlation. are not flipped and the operation is referred to as a cross-correlation.
:type image_shape: None, tuple/list of len 4 of int or Constant variable image_shape: None, tuple/list of len 4 of int or Constant variable
:param image_shape: Deprecated alias for input_shape. Deprecated alias for input_shape.
:param kwargs: Any other keyword arguments are accepted for backwards kwargs: Any other keyword arguments are accepted for backwards
compatibility, but will be ignored. compatibility, but will be ignored.
:rtype: symbolic 4D tensor Returns
:return: set of feature maps generated by convolutional layer. Tensor is -------
Symbolic 4D tensor
Set of feature maps generated by convolutional layer. Tensor is
of shape (batch size, output channels, output rows, output columns) of shape (batch size, output channels, output rows, output columns)
:note: If CuDNN is available, it will be used on the Notes
-----
If CuDNN is available, it will be used on the
GPU. Otherwise, it is the *CorrMM* convolution that will be used GPU. Otherwise, it is the *CorrMM* convolution that will be used
"caffe style convolution". "caffe style convolution".
:note: This is only supported in Theano 0.8 or the development This is only supported in Theano 0.8 or the development
version until it is released. version until it is released.
""" """
......
...@@ -124,22 +124,24 @@ class BaseAbstractConv2d(Op): ...@@ -124,22 +124,24 @@ class BaseAbstractConv2d(Op):
Define an abstract convolution op that will be replaced with the Define an abstract convolution op that will be replaced with the
appropriate implementation appropriate implementation
:type imshp: None, tuple/list of len 4 of int or Constant variable Parameters
:param imshp: The shape of the input parameter. ----------
imshp: None, tuple/list of len 4 of int or Constant variable
The shape of the input parameter.
Optional, possibly used to choose an optimal implementation. Optional, possibly used to choose an optimal implementation.
You can give ``None`` for any element of the list to specify that this You can give ``None`` for any element of the list to specify that this
element is not known at compile time. element is not known at compile time.
imshp is defined w.r.t the forward conv. imshp is defined w.r.t the forward conv.
:type kshp: None, tuple/list of len 4 of int or Constant variable kshp: None, tuple/list of len 4 of int or Constant variable
:param kshp: The shape of the filters parameter. The shape of the filters parameter.
Optional, possibly used to choose an optimal implementation. Optional, possibly used to choose an optimal implementation.
You can give ``None`` for any element of the list to specify that this You can give ``None`` for any element of the list to specify that this
element is not known at compile time. element is not known at compile time.
kshp is defined w.r.t the forward conv. kshp is defined w.r.t the forward conv.
:type border_mode: str, int or tuple of two int border_mode: str, int or tuple of two int
:param border_mode: Either of the following: Either of the following:
``'valid'``: apply filter wherever it completely overlaps with the ``'valid'``: apply filter wherever it completely overlaps with the
input. Generates output of shape: input shape - filter shape + 1 input. Generates output of shape: input shape - filter shape + 1
...@@ -154,12 +156,12 @@ class BaseAbstractConv2d(Op): ...@@ -154,12 +156,12 @@ class BaseAbstractConv2d(Op):
``(int1, int2)``: pad input with a symmetric border of ``int1`` rows ``(int1, int2)``: pad input with a symmetric border of ``int1`` rows
and ``int2`` columns, then perform a valid convolution. and ``int2`` columns, then perform a valid convolution.
:type subsample: tuple of len 2 subsample: tuple of len 2
:param subsample: factor by which to subsample the output. Factor by which to subsample the output.
Also called strides elsewhere. Also called strides elsewhere.
:type filter_flip: bool filter_flip: bool
:param filter_flip: If ``True``, will flip the filter rows and columns If ``True``, will flip the filter rows and columns
before sliding them over the input. This operation is normally referred before sliding them over the input. This operation is normally referred
to as a convolution, and this is the default. If ``False``, the filters to as a convolution, and this is the default. If ``False``, the filters
are not flipped and the operation is referred to as a are not flipped and the operation is referred to as a
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论