Skip to content

Instantly share code, notes, and snippets.

View kvanhoey's full-sized avatar

Kenneth Vanhoey kvanhoey

View GitHub Profile
kvanhoey /
Created January 15, 2020 16:49
Function to compute the amount of stride to add before and after the data arrays to obtain a 'same' convolution using a 'valid' convolution.
import math
import tensorflow as tf
import tensorflow.keras as keras
import tensorflow.keras.backend as K
def compute_amount_padding(L, F, S):
'''Compute the amount of padding to add prior to a 'valid' convolution to obtain
the same output size as for a 'same' convolution.
### Keybase proof
I hereby claim:
* I am kvanhoey on github.
* I am kvanhoey ( on keybase.
* I have a public key ASBOPSr_2_VSeXm53EVeRQs9i0EBNzGHOaILXGVg64XnpAo
To claim this, I am signing this object: