Add tensor support for num_spectrogram_bins in linear_to_mel_weight_matrix (#17404)
* Add tensor support for num_spectrogram_bins in linear_to_mel_weight_matrix This fix tries to address the issue raised in 16553 where it was not possible to provide num_spectrogram_bins as a tensor or placeholder for linear_to_mel_weight_matrix. The reason comes from the implementation of `_validate_arguments` which requires num_spectrogram_bins to be a python. However, the validation here is not necessary as `num_spectrogram_bins` will be passed to `math_ops.linspace`, which performs the validation anyway. The validation in `math_ops.linspace` is done in shape function and in kernel's `Compute()`. For that it makes sense to remove the validation of `num_spectrogram_bins` in `_validate_arguments` so that the issue raised in 16553 could be addressed. This fix adds a test case to cover the changes. Also, the error case of `num_spectrogram_bins < 0` has already been covered in the existing test case: https://github.com/tensorflow/tensorflow/blob/013a6c7b3112573ba4d932c8a22bfaf45f648c77/tensorflow/contrib/signal/python/kernel_tests/mel_ops_test.py#L149-L165 This fix fixes 16553. Signed-off-by:Yong Tang <yong.tang.github@outlook.com> * Add test case for tensor support of num_spectrogram_bins in mel_ops.linear_to_mel_weight_matrix Signed-off-by:
Yong Tang <yong.tang.github@outlook.com> * Add comment for removing validation of num_spectrogram_bins Signed-off-by:
Yong Tang <yong.tang.github@outlook.com> * Update docstring Signed-off-by:
Yong Tang <yong.tang.github@outlook.com> * Update test case for num_spectrogram_bins Signed-off-by:
Yong Tang <yong.tang.github@outlook.com> * Remove unused constant_op import to pass sanity check Signed-off-by:
Yong Tang <yong.tang.github@outlook.com>
Loading
Please sign in to comment