Conv2d

class dragon.vm.tensorlayer.layers.Conv2d(
  n_filter,
  filter_size=3,
  strides=1,
  act=None,
  padding='SAME',
  data_format='channels_first',
  dilation_rate=1,
  W_init='glorot_uniform',
  b_init=None,
  in_channels=None,
  name=None
)[source]

The 2d convolution layer.

Examples:

# Define and call a conv2d layer with the input
x = tl.layers.Input([8, 3, 400, 400])
y = tl.layers.Conv2d(n_filter=32, filter_size=3, stride=2)(x)

__init__

Conv2d.__init__(
  n_filter,
  filter_size=3,
  strides=1,
  act=None,
  padding='SAME',
  data_format='channels_first',
  dilation_rate=1,
  W_init='glorot_uniform',
  b_init=None,
  in_channels=None,
  name=None
)[source]

Create a Conv2d layer.

Parameters:
  • n_filter (int, required) – The number of output filters.
  • filter_size (Sequence[int], optional, default=3) – The size of filter.
  • strides (Sequence[int], optional, default=1) – The stride(s) of sliding window.
  • act (callable, optional) – The optional activation function.
  • padding (Union[{'VALID', 'SAME'}, Sequence[int]]) – The padding algorithm or padding sizes.
  • data_format ({'channels_first', 'channels_last'}, optional) – The optional data format.
  • dilation_rate (Sequence[int], optional) – The rate(s) of dilated kernel.
  • W_init (Union[callable, str], optional) – The initializer for weight matrix.
  • b_init (Union[callable, str], optional) – The initializer for bias vector.
  • in_channels (int, optional) – The number of input channels.
  • name (str, optional) – The optional layer name.