Convolution // A batched convolution operation
Description¶
Long description
Inputs¶
Name |
Element Type |
Shape |
---|---|---|
|
Any |
|
|
Same as |
|
Attributes¶
Name |
Type |
Notes |
---|---|---|
|
|
How far to slide the window along each axis at each step |
|
|
Per-axis dilation to apply to the filters |
|
|
How many padding elements to add below the 0-coordinate on each axis |
|
|
How many padding elements to add above the max-coordinate on each axis |
|
|
Per-axis dilation to apply to the image batch |
Outputs¶
Name |
Element Type |
Shape |
---|---|---|
|
Same as |
|
It must be the case that after dilation and padding are applied, the filter fits within the image.
Mathematical Definition¶
Padding¶
Let \(p\) (the padding below) and \(q\) (the padding above) be a sequence of \(n\) integers, and \(T\) be a tensor of shape \((d_1,\dots,d_n)\), such that for all \(i\), \(p_i + d_i + q_i \ge 0\). Then \(\mathit{Pad}[p,q](T)\) is the tensor of shape \((p_1 + d_1 + q_1,\dots,p_n + d_n + q_n)\) such that
Dilation¶
Let \(l\) (the dilation strides) be a sequence of \(n\) positive integers, and \(T\) be a tensor of shape \((d_1,\dots,d_n)\). Then \(\mathit{Dilate}[l](T)\) is the tensor of shape \((d'_1,\dots,d'_n)\) where \(d'_i = \mathit{max}(0,l_i(d_i - 1) + 1)\) such that
Striding¶
Let \(s\) (the strides) be a sequence of \(n\) positive integers, and \(T\) be a tensor of shape \((d_1,\dots,d_n)\). Then \(\mathit{Stride}[s](T)\) is the tensor of shape \((d'_1,\dots,d'_n)\) where \(d'_i = \left\lceil \frac{d_i}{s_i} \right\rceil\) such that
\(s\) is the how far, not the unit of farness.
Convolution¶
Padded, Dilated, Strided Convolution¶
Batched, Padded, Dilated, Strided Convolution¶
C++ Interface¶
-
class
Convolution
: public ngraph::op::Op¶ -
Batched convolution operation, with optional window dilation and stride.
Public Functions
-
const std::string &
description
() const¶ -
Get the string name for the type of the node, such as
Add
orMultiply
. The class name, must not contain spaces as it is used for codegen.- Return
-
A const reference to the node’s type name
-
Convolution
()¶ -
Constructs a batched convolution operation.
-
Convolution
(const Output<Node> &data_batch, const Output<Node> &filters, const Strides &window_movement_strides, const Strides &window_dilation_strides, const CoordinateDiff &padding_below, const CoordinateDiff &padding_above, const Strides &data_dilation_strides, const PadType &pad_type = PadType::EXPLICIT)¶ -
Constructs a batched convolution operation.
Output
[N, C_OUT, R1, ... Rf]
- Parameters
-
data_batch
: The node producing the input data batch tensor.[N, C_IN, D1, ... Df]
filters
: The node producing the filters tensor.[C_OUT, C_IN, F1, ... Ff]
window_movement_strides
: The window movement strides.[f]
window_dilation_strides
: The window dilation strides.[f]
padding_below
: The padding-below sizes.[f]
padding_above
: The padding-above sizes.[f]
data_dilation_strides
: The data dilation strides.[f]
pad_type
: The pad type for automatically computing padding sizes.[f]
-
Convolution
(const Output<Node> &data_batch, const Output<Node> &filters, const Strides &window_movement_strides, const Strides &window_dilation_strides, const CoordinateDiff &padding_below, const CoordinateDiff &padding_above)¶ -
Constructs a batched convolution operation with no data dilation (i.e., all data dilation strides are 1).
Output
[N, C_OUT, R1, ... Rf]
- Parameters
-
data_batch
: The node producing the input data batch tensor.[N, C_IN, D1, ... Df]
filters
: The node producing the filters tensor.[C_OUT, C_IN, F1, ... Ff]
window_movement_strides
: The window movement strides.[f]
window_dilation_strides
: The window dilation strides.[f]
padding_below
: The padding-below sizes.[f]
padding_above
: The padding-above sizes.[f]
-
Convolution
(const Output<Node> &data_batch, const Output<Node> &filters, const Strides &window_movement_strides, const Strides &window_dilation_strides)¶ -
Constructs a batched convolution operation with no padding or data dilation (i.e., padding above and below are 0 everywhere, and all data dilation strides are 1).
Output
[N, C_OUT, R1, ... Rf]
- Parameters
-
data_batch
: The node producing the input data batch tensor.[N, C_IN, D1, ... Df]
filters
: The node producing the filters tensor.[C_OUT, C_IN, F1, ... Ff]
window_movement_strides
: The window movement strides.[f]
window_dilation_strides
: The window dilation strides.[f]
-
Convolution
(const Output<Node> &data_batch, const Output<Node> &filters, const Strides &window_movement_strides)¶ -
Constructs a batched convolution operation with no window dilation, padding, or data dilation (i.e., padding above and below are 0 everywhere, and all window/data dilation strides are 1).
Output
[N, C_OUT, R1, ... Rf]
- Parameters
-
data_batch
: The node producing the input data batch tensor.[N, C_IN, D1, ... Df]
filters
: The node producing the filters tensor.[C_OUT, C_IN, F1, ... Ff]
window_movement_strides
: The window movement strides.[f]
-
Convolution
(const Output<Node> &data_batch, const Output<Node> &filters)¶ -
Constructs a batched convolution operation with no window dilation or movement stride (i.e., padding above and below are 0 everywhere, and all window/data dilation strides and window movement strides are 1).
Output
[N, C_OUT, R1, ... Rf]
- Parameters
-
data_batch
: The node producing the input data batch tensor.[N, C_IN, D1, ... Df]
filters
: The node producing the filters tensor.[C_OUT, C_IN, F1, ... Ff]
-
void
validate_and_infer_types
()¶ -
Throws if the node is invalid.
-
const Strides &
get_window_movement_strides
() const¶ -
- Return
-
The window movement strides.
-
const Strides &
get_window_dilation_strides
() const¶ -
- Return
-
The window dilation strides.
-
const CoordinateDiff &
get_padding_below
() const¶ -
- Return
-
The padding-below sizes (possibly negative).
-
const CoordinateDiff &
get_padding_above
() const¶ -
- Return
-
The padding-above sizes (possibly negative).
-
const Strides &
get_data_dilation_strides
() const¶ -
- Return
-
The input data dilation strides.
-
const PadType &
get_pad_type
() const¶ -
- Return
-
The pad type for convolution.
-
virtual std::shared_ptr<Node>
get_default_value
() const¶ -
- Return
-
The default value for Convolution.
-
const std::string &