0

Given I have the following:

s: stride
k: kernel size
i: input size
n: number of times a convolution layer was performed

With the convolution layer having the following parameters:

input = [b, i, i, c] (with batch size b and channel size c)
padding = 'SAME'
stride = s
kernel_size = k   

Is there a mathematical way to calculate the final output size?

I can do the following to programmatically calculate the final output size:

final_size = i
for _ in range(n):
    final_size = np.ceil(final_size / s)
Spenhouet
  • 6,556
  • 12
  • 51
  • 76

1 Answers1

1

Yes. ceil(ceil(x / n) / m) = ceil(x / (x * m)) (at least for integer n and m), so it should simply be final_size = np.ceil(i / (s ** n)).

MinosIllyrien
  • 330
  • 1
  • 9