-
Notifications
You must be signed in to change notification settings - Fork 943
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 approvals obtained (waiting on @Lewuathe)
src/ops/spectral_ops.ts, line 109 at r1 (raw file):
* @doc {heading: 'Operations', subheading: 'Spectral', namespace: 'spectral'} */ function rfft_(input: Tensor, fftLength: number = null): Tensor {
no need to specify null here
src/ops/spectral_ops.ts, line 109 at r1 (raw file):
* @doc {heading: 'Operations', subheading: 'Spectral', namespace: 'spectral'} */ function rfft_(input: Tensor, fftLength: number = null): Tensor {
in tensorflow fftLength is a Tensor, can you make this a TensorLike and then convert it?
src/ops/spectral_ops_test.ts, line 219 at r1 (raw file):
it('should return the same value without any fftLength', async () => { const t1Real = tf.tensor1d([-3, -2, -1, 1, 2, 3]); expectArraysClose(await tf.spectral.rfft(t1Real, 6).data(), [
can you pull the numbers to a constant const fftLength = 4;
for readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 approvals obtained (waiting on @nsthorat)
src/ops/spectral_ops.ts, line 109 at r1 (raw file):
Previously, nsthorat (Nikhil Thorat) wrote…
no need to specify null here
But otherwise, it breaks the compatibility. I mean we always need to pass two arguments for rfft.
src/ops/spectral_ops.ts, line 109 at r1 (raw file):
Previously, nsthorat (Nikhil Thorat) wrote…
in tensorflow fftLength is a Tensor, can you make this a TensorLike and then convert it?
How can we safely convert TensorLike to number? Is there any common way?
src/ops/spectral_ops_test.ts, line 219 at r1 (raw file):
Previously, nsthorat (Nikhil Thorat) wrote…
can you pull the numbers to a constant
const fftLength = 4;
for readability
Sure will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 approvals obtained (waiting on @Lewuathe)
src/ops/spectral_ops.ts, line 109 at r1 (raw file):
Previously, Lewuathe (Kai Sasaki) wrote…
But otherwise, it breaks the compatibility. I mean we always need to pass two arguments for rfft.
I just mean this with a question mark:
rfft_(input: Tensor, fftLength?: number)
src/ops/spectral_ops.ts, line 109 at r1 (raw file):
Previously, Lewuathe (Kai Sasaki) wrote…
How can we safely convert TensorLike to number? Is there any common way?
Ah, didn't realize the shape was a function of this. This is fine for now.
src/ops/spectral_ops_test.ts, line 219 at r1 (raw file):
Previously, Lewuathe (Kai Sasaki) wrote…
Sure will do.
Let me know when this is done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 approvals obtained (waiting on @Lewuathe and @nsthorat)
src/ops/spectral_ops.ts, line 109 at r1 (raw file):
Previously, nsthorat (Nikhil Thorat) wrote…
I just mean this with a question mark:
rfft_(input: Tensor, fftLength?: number)
Oh, I see. Thanks will do.
@nsthorat I updated accordingly. Could you take a look again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2.
Reviewable status:complete! 1 of 1 approvals obtained
Thanks @Lewuathe as always high quality PR :) |
In order to implement stft without introducing future breaking change,
rfft
should be able to getfftLength
param in advance. That is compatible with TensorFlow corerfft
ops.See: https://www.tensorflow.org/api_docs/python/tf/signal/rfft
This change is