Output dimension from convolution layer

How to calculate dimension of output from a convolution layer?


No padding (aka valid padding):

input = n x n = 6 x 6

kernel = f x f = 3 x 3

output = m x m = 4 x 4

How do we get output = 4 x 4 ?

Ans: Use the formula: (n - f + 1) x (n - f + 1)


With padding of size 1:

p = 1

input = n x n = 6 x 6

kernel = f x f = 3 x 3

output = m x m = 6 x 6

How do we get output = 6 x 6 ?

Ans: Use the formula: (n + 2p - f + 1) x (n + 2p - f + 1)


Meaning of valid padding & same padding:

1) No padding is also known as valid padding.

2) Same padding means pad input so that the resulting output dimension after convolution will be the same as input.


Size of padding needed to achieve same padding:

Size of padding needed to achieve same padding depends on the kernel size, f.

Using p = (f - 1) / 2 will produce output dimension = input dimension.



2020

PBT for MARL

46 minute read

My attempt to implement a water down version of PBT (Population based training) for MARL (Multi-agent reinforcement learning).

Back to top ↑

2019

.bash_profile for Mac

13 minute read

This post demonstrates how to create customized functions to bundle commands in a .bash_profile file on Mac.

DPPO distributed tensorflow

68 minute read

This post documents my implementation of the Distributed Proximal Policy Optimization (Distributed PPO or DPPO) algorithm. (Distributed continuous version)

A3C distributed tensorflow

26 minute read

This post documents my implementation of the A3C (Asynchronous Advantage Actor Critic) algorithm (Distributed discrete version).

Distributed Tensorflow

76 minute read

This post demonstrates a simple usage example of distributed Tensorflow with Python multiprocessing package.

N-step targets

76 minute read

This post documents my implementation of the N-step Q-values estimation algorithm.

Dueling DDQN with PER

49 minute read

This post documents my implementation of the Dueling Double Deep Q Network with Priority Experience Replay (Duel DDQN with PER) algorithm.

Dueling DDQN

24 minute read

This post documents my implementation of the Dueling Double Deep Q Network (Dueling DDQN) algorithm.

DDQN

29 minute read

This post documents my implementation of the Double Deep Q Network (DDQN) algorithm.

DQN

24 minute read

This post documents my implementation of the Deep Q Network (DQN) algorithm.

Back to top ↑