AlexanderLutsenko / nobuco

Pytorch to Keras/Tensorflow/TFLite conversion made intuitive
MIT License
272 stars 17 forks source link

FIX #31: failed to conversion a convolution when padding argument is 'valid' or default #32

Closed kokeshing closed 7 months ago

kokeshing commented 7 months ago

This PR is for #31

From my own investigation, it seems that the cause is that valid is passed to ZeroPadding() in the following part of the conversion function for each convolution in node_converters/convolution.py.

if padding == 'same':
    pad_str = 'same'
elif padding != (0, 0):
    pad_layer = keras.layers.ZeroPadding2D(padding)

Therefore, I have added an if statement to make sure that the padding is not valid.

if padding != 'valid':
    if padding == 'same':
        pad_str = 'same'
    elif padding != (0, 0):
        pad_layer = keras.layers.ZeroPadding2D(padding)

I would like to have your review to this PR.

kokeshing commented 7 months ago

I have force pushed to fix the commiter information.