In TensorFlow, if we want to add a convolutional layer, we will write the following:
tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None, data_format=None, name=None)
The following are the arguments:
- input: A tensor, must be one of the following types: half, float32, float64.
- filter: A tensor, must have the same type as input.
- strides: A list of ints. 1D of length 4. The stride of the sliding window for each dimension of input. Must be in the same order as the dimension specified with format.
- padding: A string from: SAME, VALID. The type of padding algorithm to use.
- use_cudnn_on_gpu: An optional bool. Defaults to True.
- data_format: An optional string from: NHWC and NCHW. Defaults to NHWC. Specifies the data format of the input and output data. With the default format NHWC, the data is stored in the order of: [batch, in_height, in_width, and in_channels]. Alternatively, the format could be NCHW, the data storage order of: [batch, in_channels, in_height, in_width].
- name: A name for the operation (optional).
An example of convolution is provided in the following image:
An example of convolutional operation