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]

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 convolution window.
  • strides (Union[int, Sequence[int]], optional, default=1) – The stride of convolution window.
  • act (callable, optional) – The optional activation function.
  • padding (Union[int, Sequence[int], str], optional, default='SAME') – The padding algorithm or size.
  • data_format (str, optional, default='channels_first') – 'channels_first' or 'channels_last'.
  • dilation_rate (Sequence[int], optional) – The rate of dilated convolution.
  • W_init (Union[callable, str], optional) – The initializer for weight tensor.
  • b_init (Union[callable, str], optional) – The initializer for bias tensor.
  • in_channels (int, optional) – The number of input channels.
  • name (str, optional) – The layer name.