Skip to content

Instantly share code, notes, and snippets.

Avatar

Kenneth Vanhoey kvanhoey

View GitHub Profile
@kvanhoey
kvanhoey / conv2D_padding.py
Created Jan 15, 2020
Function to compute the amount of stride to add before and after the data arrays to obtain a 'same' convolution using a 'valid' convolution.
View conv2D_padding.py
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.
View gist:46e715cc793339eb781339e979e7df15
### Keybase proof
I hereby claim:
* I am kvanhoey on github.
* I am kvanhoey (https://keybase.io/kvanhoey) on keybase.
* I have a public key ASBOPSr_2_VSeXm53EVeRQs9i0EBNzGHOaILXGVg64XnpAo
To claim this, I am signing this object: