-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the padding for dilated convolution seems to be wrong #5
Comments
For filter_width=3, dilation=1 => dilation/2 = 0 |
sorry its a typo, dilation = 2 |
I just tested So for the Another way to correct it is to keep the padding but change the pad in |
The padding setting for the decoder is correct.
This is done to preserve the causality. Refer to the bytenet decoder diagram for further clarity. Check For the encoder, The current code is fine as well. If you are using an odd filter width (1,3,5..) it shouldn't be a problem. I think having a look at the diagram again might help. The first output of the encoder depends only on the first and the third element, which will be the case if :
is the padded input for conv1d. Let me know if you still think I may be wrong. |
You are ignoring the padding from '''conv1d''' itself, the input is ''' |
Oh, I see. I just went through the documentation of tf.nn.conv1d. It seems that the input may be paded differently for different input lengths, which is not desirable. Changing it to |
@zcyang Updated the ops. The model works correctly now. It was indeed an error in encoder padding. Check |
For encoder, the dilated convolution for encoder pads
(filter_width - 1) * dilation/2
, this means after reshaping there are(filter_width-1)
zeros at the beginning. Butconv1d
usesSAME
padding, which again, will pad(filter_width-1)
number of zeros, which duplicates the zeros needed.Assume
filter_width=3, dilation=2
, the input is1 2 3 4 5
Ater padding in dilated convolution function, the input becomes
0 0 1 2 3 4 5 0 0
After the reshape,
becomes the input to
conv1d
, which will again, pad withfilter_width-1
zeros with theSAME
padding schemeThe text was updated successfully, but these errors were encountered: