提交 b4b19ff5 authored 作者: slefrancois's avatar slefrancois

add pdf figures to conv_arith tutorial for pdf doc

上级 da95bf92
...@@ -77,7 +77,7 @@ in the input). ...@@ -77,7 +77,7 @@ in the input).
Here is an example of a discrete convolution: Here is an example of a discrete convolution:
.. figure:: conv_arithmetic_figures/numerical_no_padding_no_strides.gif .. figure:: conv_arithmetic_figures/numerical_no_padding_no_strides.*
:figclass: align-center :figclass: align-center
The light blue grid is called the *input feature map*. A *kernel* (shaded area) The light blue grid is called the *input feature map*. A *kernel* (shaded area)
...@@ -149,7 +149,7 @@ For instance, here is a :math:`3 \times 3` kernel applied to a ...@@ -149,7 +149,7 @@ For instance, here is a :math:`3 \times 3` kernel applied to a
:math:`5 \times 5` input padded with a :math:`1 \times 1` border of zeros using :math:`5 \times 5` input padded with a :math:`1 \times 1` border of zeros using
:math:`2 \times 2` strides: :math:`2 \times 2` strides:
.. figure:: conv_arithmetic_figures/numerical_padding_strides.gif .. figure:: conv_arithmetic_figures/numerical_padding_strides.*
:figclass: align-center :figclass: align-center
The analysis of the relationship between convolutional layer properties is eased The analysis of the relationship between convolutional layer properties is eased
...@@ -206,7 +206,7 @@ The simplest case to analyze is when the kernel just slides across every ...@@ -206,7 +206,7 @@ The simplest case to analyze is when the kernel just slides across every
position of the input (i.e., :math:`s = 1` and :math:`p = 0`). position of the input (i.e., :math:`s = 1` and :math:`p = 0`).
Here is an example for :math:`i = 4` and :math:`k = 3`: Here is an example for :math:`i = 4` and :math:`k = 3`:
.. figure:: conv_arithmetic_figures/no_padding_no_strides.gif .. figure:: conv_arithmetic_figures/no_padding_no_strides.*
:figclass: align-center :figclass: align-center
One way of defining the output size in this case is by the number of possible One way of defining the output size in this case is by the number of possible
...@@ -265,7 +265,7 @@ relationship: ...@@ -265,7 +265,7 @@ relationship:
Here is an example for :math:`i = 5`, :math:`k = 4` and :math:`p = 2`: Here is an example for :math:`i = 5`, :math:`k = 4` and :math:`p = 2`:
.. figure:: conv_arithmetic_figures/arbitrary_padding_no_strides.gif .. figure:: conv_arithmetic_figures/arbitrary_padding_no_strides.*
:figclass: align-center :figclass: align-center
Special cases Special cases
...@@ -305,7 +305,7 @@ be a desirable property: ...@@ -305,7 +305,7 @@ be a desirable property:
This is sometimes referred to as *half* (or *same*) padding. Here is an example This is sometimes referred to as *half* (or *same*) padding. Here is an example
for :math:`i = 5`, :math:`k = 3` and (therefore) :math:`p = 1`: for :math:`i = 5`, :math:`k = 3` and (therefore) :math:`p = 1`:
.. figure:: conv_arithmetic_figures/same_padding_no_strides.gif .. figure:: conv_arithmetic_figures/same_padding_no_strides.*
:figclass: align-center :figclass: align-center
Note that half padding also works for even-valued :math:`k` and for :math:`s > Note that half padding also works for even-valued :math:`k` and for :math:`s >
...@@ -347,7 +347,7 @@ possible partial or complete superimposition of the kernel on the input feature ...@@ -347,7 +347,7 @@ possible partial or complete superimposition of the kernel on the input feature
map is taken into account. Here is an example for :math:`i = 5`, :math:`k = 3` map is taken into account. Here is an example for :math:`i = 5`, :math:`k = 3`
and (therefore) :math:`p = 2`: and (therefore) :math:`p = 2`:
.. figure:: conv_arithmetic_figures/full_padding_no_strides.gif .. figure:: conv_arithmetic_figures/full_padding_no_strides.*
:figclass: align-center :figclass: align-center
No zero padding, non-unit strides No zero padding, non-unit strides
...@@ -359,7 +359,7 @@ the analysis, let's momentarily ignore zero padding (i.e., :math:`s > 1` and ...@@ -359,7 +359,7 @@ the analysis, let's momentarily ignore zero padding (i.e., :math:`s > 1` and
:math:`p = 0`). Here is an example for :math:`i = 5`, :math:`k = 3` and :math:`s :math:`p = 0`). Here is an example for :math:`i = 5`, :math:`k = 3` and :math:`s
= 2`: = 2`:
.. figure:: conv_arithmetic_figures/no_padding_strides.gif .. figure:: conv_arithmetic_figures/no_padding_strides.*
:figclass: align-center :figclass: align-center
Once again, the output size can be defined in terms of the number of possible Once again, the output size can be defined in terms of the number of possible
...@@ -428,13 +428,13 @@ that this ambiguity applies only for :math:`s > 1`. ...@@ -428,13 +428,13 @@ that this ambiguity applies only for :math:`s > 1`.
Here is an example for :math:`i = 5`, :math:`k = 3`, :math:`s = 2` and :math:`p Here is an example for :math:`i = 5`, :math:`k = 3`, :math:`s = 2` and :math:`p
= 1`: = 1`:
.. figure:: conv_arithmetic_figures/padding_strides.gif .. figure:: conv_arithmetic_figures/padding_strides.*
:figclass: align-center :figclass: align-center
Here is an example for :math:`i = 6`, :math:`k = 3`, :math:`s = 2` and :math:`p Here is an example for :math:`i = 6`, :math:`k = 3`, :math:`s = 2` and :math:`p
= 1`: = 1`:
.. figure:: conv_arithmetic_figures/padding_strides_odd.gif .. figure:: conv_arithmetic_figures/padding_strides_odd.*
:figclass: align-center :figclass: align-center
Interestingly, despite having different input sizes these convolutions share the Interestingly, despite having different input sizes these convolutions share the
...@@ -478,7 +478,7 @@ Convolution as a matrix operation ...@@ -478,7 +478,7 @@ Convolution as a matrix operation
Take for example the convolution presented in the *No zero padding, unit Take for example the convolution presented in the *No zero padding, unit
strides* subsection: strides* subsection:
.. figure:: conv_arithmetic_figures/no_padding_no_strides.gif .. figure:: conv_arithmetic_figures/no_padding_no_strides.*
:figclass: align-center :figclass: align-center
If the input and output were to be unrolled into vectors from left to right, top If the input and output were to be unrolled into vectors from left to right, top
...@@ -572,7 +572,7 @@ Let's consider the convolution of a :math:`3 \times 3` kernel on a :math:`4 ...@@ -572,7 +572,7 @@ Let's consider the convolution of a :math:`3 \times 3` kernel on a :math:`4
:math:`k = 3`, :math:`s = 1` and :math:`p = 0`). As depicted in the convolution :math:`k = 3`, :math:`s = 1` and :math:`p = 0`). As depicted in the convolution
below, this produces a :math:`2 \times 2` output: below, this produces a :math:`2 \times 2` output:
.. figure:: conv_arithmetic_figures/no_padding_no_strides.gif .. figure:: conv_arithmetic_figures/no_padding_no_strides.*
:figclass: align-center :figclass: align-center
The transpose of this convolution will then have an output of shape :math:`4 The transpose of this convolution will then have an output of shape :math:`4
...@@ -585,7 +585,7 @@ a :math:`2 \times 2` input padded with a :math:`2 \times 2` border of zeros ...@@ -585,7 +585,7 @@ a :math:`2 \times 2` input padded with a :math:`2 \times 2` border of zeros
using unit strides (i.e., :math:`i' = 2`, :math:`k' = k`, :math:`s' = 1` and using unit strides (i.e., :math:`i' = 2`, :math:`k' = k`, :math:`s' = 1` and
:math:`p' = 2`), as shown here: :math:`p' = 2`), as shown here:
.. figure:: conv_arithmetic_figures/no_padding_no_strides_transposed.gif .. figure:: conv_arithmetic_figures/no_padding_no_strides_transposed.*
:figclass: align-center :figclass: align-center
Notably, the kernel's and stride's sizes remain the same, but the input of the Notably, the kernel's and stride's sizes remain the same, but the input of the
...@@ -646,7 +646,7 @@ padded with *less* zeros. ...@@ -646,7 +646,7 @@ padded with *less* zeros.
It is indeed the case, as shown in here for :math:`i = 5`, :math:`k = 4` and It is indeed the case, as shown in here for :math:`i = 5`, :math:`k = 4` and
:math:`p = 2`: :math:`p = 2`:
.. figure:: conv_arithmetic_figures/arbitrary_padding_no_strides_transposed.gif .. figure:: conv_arithmetic_figures/arbitrary_padding_no_strides_transposed.*
:figclass: align-center :figclass: align-center
Formally, the following relationship applies for zero padded convolutions: Formally, the following relationship applies for zero padded convolutions:
...@@ -713,7 +713,7 @@ applies: ...@@ -713,7 +713,7 @@ applies:
Here is an example for :math:`i = 5`, :math:`k = 3` and (therefore) :math:`p = Here is an example for :math:`i = 5`, :math:`k = 3` and (therefore) :math:`p =
1`: 1`:
.. figure:: conv_arithmetic_figures/same_padding_no_strides_transposed.gif .. figure:: conv_arithmetic_figures/same_padding_no_strides_transposed.*
:figclass: align-center :figclass: align-center
Full padding, transposed Full padding, transposed
...@@ -749,7 +749,7 @@ the transpose of a fully padded convolution is a non-padded convolution: ...@@ -749,7 +749,7 @@ the transpose of a fully padded convolution is a non-padded convolution:
Here is an example for :math:`i = 5`, :math:`k = 3` and (therefore) :math:`p = Here is an example for :math:`i = 5`, :math:`k = 3` and (therefore) :math:`p =
2`: 2`:
.. figure:: conv_arithmetic_figures/full_padding_no_strides_transposed.gif .. figure:: conv_arithmetic_figures/full_padding_no_strides_transposed.*
:figclass: align-center :figclass: align-center
No zero padding, non-unit strides, transposed No zero padding, non-unit strides, transposed
...@@ -763,7 +763,7 @@ intuition, which is why transposed convolutions are sometimes called ...@@ -763,7 +763,7 @@ intuition, which is why transposed convolutions are sometimes called
Here is an example for :math:`i = 5`, :math:`k = 3` and :math:`s = 2`: Here is an example for :math:`i = 5`, :math:`k = 3` and :math:`s = 2`:
.. figure:: conv_arithmetic_figures/no_padding_strides_transposed.gif .. figure:: conv_arithmetic_figures/no_padding_strides_transposed.*
:figclass: align-center :figclass: align-center
This should help understand what fractional strides involve: zeros This should help understand what fractional strides involve: zeros
...@@ -840,7 +840,7 @@ combining :ref:`Relationship 8 <Relationship8>` and ...@@ -840,7 +840,7 @@ combining :ref:`Relationship 8 <Relationship8>` and
Here is an example for :math:`i = 5`, :math:`k = 3`, :math:`s = 2` and :math:`p Here is an example for :math:`i = 5`, :math:`k = 3`, :math:`s = 2` and :math:`p
= 1`: = 1`:
.. figure:: conv_arithmetic_figures/padding_strides_transposed.gif .. figure:: conv_arithmetic_figures/padding_strides_transposed.*
:figclass: align-center :figclass: align-center
The constraint on the size of the input :math:`i` can be relaxed by introducing The constraint on the size of the input :math:`i` can be relaxed by introducing
...@@ -875,7 +875,7 @@ between the :math:`s` different cases that all lead to the same :math:`i'`: ...@@ -875,7 +875,7 @@ between the :math:`s` different cases that all lead to the same :math:`i'`:
Here is an example for :math:`i = 6`, :math:`k = 3`, :math:`s = 2` and :math:`p Here is an example for :math:`i = 6`, :math:`k = 3`, :math:`s = 2` and :math:`p
= 1`: = 1`:
.. figure:: conv_arithmetic_figures/padding_strides_odd_transposed.gif .. figure:: conv_arithmetic_figures/padding_strides_odd_transposed.*
:figclass: align-center :figclass: align-center
.. [#] Dumoulin, Vincent, and Visin, Francesco. "A guide to convolution .. [#] Dumoulin, Vincent, and Visin, Francesco. "A guide to convolution
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论