The simple_img_conv_pool is composed with one Convolution2d and one Pool2d.

Parameters:

input (Variable) – The input image with [N, C, H, W] format.

num_filters (int) – The number of filter. It is as same as the output
feature channel.

filter_size (int|list|tuple) – The filter size. If filter_size is a list or
tuple, it must contain two integers, (filter_size_H, filter_size_W). Otherwise,
the filter_size_H = filter_size_W = filter_size.

pool_size (int|list|tuple) – The pooling size of Pool2d layer. If pool_size
is a list or tuple, it must contain two integers, (pool_size_H, pool_size_W).
Otherwise, the pool_size_H = pool_size_W = pool_size.

pool_stride (int|list|tuple) – The pooling stride of Pool2d layer. If pool_stride
is a list or tuple, it must contain two integers, (pooling_stride_H, pooling_stride_W).
Otherwise, the pooling_stride_H = pooling_stride_W = pool_stride.

pool_padding (int|list|tuple) – The padding of Pool2d layer. If pool_padding is a list or
tuple, it must contain two integers, (pool_padding_H, pool_padding_W).
Otherwise, the pool_padding_H = pool_padding_W = pool_padding. Default 0.

pool_type (str) – Pooling type can be \(max\) for max-pooling and \(avg\) for
average-pooling. Default \(max\).

global_pooling (bool) – Whether to use the global pooling. If global_pooling = true,
pool_size and pool_padding while be ignored. Default False

conv_stride (int|list|tuple) – The stride size of the Conv2d Layer. If stride is a
list or tuple, it must contain two integers, (conv_stride_H, conv_stride_W). Otherwise,
the conv_stride_H = conv_stride_W = conv_stride. Default: conv_stride = 1.

conv_padding (int|list|tuple) – The padding size of the Conv2d Layer. If padding is
a list or tuple, it must contain two integers, (conv_padding_H, conv_padding_W).
Otherwise, the conv_padding_H = conv_padding_W = conv_padding. Default: conv_padding = 0.

conv_dilation (int|list|tuple) – The dilation size of the Conv2d Layer. If dilation is
a list or tuple, it must contain two integers, (conv_dilation_H, conv_dilation_W).
Otherwise, the conv_dilation_H = conv_dilation_W = conv_dilation. Default: conv_dilation = 1.

conv_groups (int) – The groups number of the Conv2d Layer. According to grouped
convolution in Alex Krizhevsky’s Deep CNN paper: when group=2,
the first half of the filters is only connected to the first half
of the input channels, while the second half of the filters is only
connected to the second half of the input channels. Default: groups=1

The sequence_conv_pool is composed with Sequence Convolution and Pooling.

Parameters:

input (Variable) – The input of sequence_conv, which supports variable-time
length input sequence. The underlying of input is a matrix with shape
(T, N), where T is the total time steps in this mini-batch and N is
the input_hidden_size

The Gated Linear Units(GLU) composed by split, sigmoid activation and element-wise
multiplication. Specifically, Split the input into two equal sized parts,
\(a\) and \(b\), along the given dimension and then compute as
following:

Attention mechanism can be seen as mapping a query and a set of key-value
pairs to an output. The output is computed as a weighted sum of the values,
where the weight assigned to each value is computed by a compatibility
function (dot-product here) of the query with the corresponding key.

The dot-product attention can be implemented through (batch) matrix
multipication as follows:

When num_heads > 1, three linear projections are learned respectively
to map input queries, keys and values into queries’, keys’ and values’.
queries’, keys’ and values’ have the same shapes with queries, keys
and values.

When num_heads == 1, scaled_dot_product_attention has no learnable
parameters.