Skip to content
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

OFDMModulator() returns a time-domain OFDM signal with size = None (in training) #7

Closed
kassankar opened this issue Apr 11, 2022 · 5 comments

Comments

@kassankar
Copy link
Contributor

kassankar commented Apr 11, 2022

Describe the bug
The class OFDMModulator() returns a time-domain OFDM signal with size = None while Training the Keras model. (only while training the model)

To Reproduce
Please find a gist link : "https://gist.github.com/kassankar/70d62384d05b00fa8b9486ed862a4784" to reproduce the error.

The bug occurred while running block number 7 due to OFDMModulator() in block number 6.

Expected behavior
Based on the OFDMModulator description, the function should return an output size = num_ofdm_symbols*(fft_size+cyclic_prefix_length)

Screenshots

image

Additional context
The problem is directly connected to the function flatten_last_dims() used in the OFDMModulator() class. More precisely, in the last two lines new_shape = tf.concat([shape[:-num_dims], [-1]], 0), return tf.reshape(tensor, new_shape). I think the problem is occuring due to the use of [-1] in the tf.reshape() function. In the training the batch_size is equal to None, and based on the description of the tf.reshape() function with an axis shape = [-1], the dimension is computed so that the total size remains constant. However, due to batch_size = None, the tf.reshape() return another 'None' dimension for the last output.

Note: tf.reshape() with [-1] is also used in OFDMDemodulator(), in
new_shape = tf.concat([tf.shape(inputs)[:-1], [-1], [self.fft_size + self.cyclic_prefix_length]], 0)

@jhoydis
Copy link
Collaborator

jhoydis commented Apr 11, 2022

Thank you for this bug report. Could you please provide a gist instead of a pdf, so that we can easily copy the code? Could you provide a code example that isolates the problem as much as possible, i.e., the shortest possible code snippet that allows us to reproduce the bug?

@kassankar
Copy link
Contributor Author

Thank you for this bug report. Could you please provide a gist instead of a pdf, so that we can easily copy the code? Could you provide a code example that isolates the problem as much as possible, i.e., the shortest possible code snippet that allows us to reproduce the bug?

Done!
I hope it is better now.

@jhoydis
Copy link
Collaborator

jhoydis commented Apr 11, 2022

Hi, I think that there is an issue with you gist. The model in cell 6 does not seem to return anything. I have created an alternative gist, similar to yours, which works nicely: https://gist.github.com/jhoydis/0f09064c89accdb55c8135afcb1982e9
Could you check which modifications would need to be done in this code to reproduce the error?

@kassankar
Copy link
Contributor Author

Hi,
Thanks for the gist modification. It looks way better.
Please, find the new gist (similar to yours), with three lines added after the line number 54 :

  • print(x_time.shape)
  • x_f = self._ofdm_demod(x_time)
  • return x_f.
    The print is only used to show the None that appears in the dimension.

(BTW, I did not add a return to the function since the print(x_time.shape) alongside x_f = self._ofdm_demod(x_time) are sufficient to present the bug. But I can understand my gist is not well-arranged :) )

gist v2: https://gist.github.com/kassankar/15842eaa59c4cbb969ad0aded2ff5613

@jhoydis
Copy link
Collaborator

jhoydis commented Apr 11, 2022

I was able to reproduce the error in this minimal gist: https://gist.github.com/jhoydis/7720a7a2af236e5061d907e969084e85
The bug will be fixed in the next release.

@faycalaa faycalaa closed this as completed May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants