-
Notifications
You must be signed in to change notification settings - Fork 657
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
Add psd method to torchaudio.functional #2227
Conversation
482cedd
to
48399ae
Compare
6f04a52
to
fd896a1
Compare
@@ -617,6 +617,29 @@ def test_phase_vocoder(self): | |||
)[..., None] | |||
self._assert_consistency_complex(F.phase_vocoder, (tensor, rate, phase_advance)) | |||
|
|||
def test_psd(self): | |||
def func(specgram): |
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.
Is this helper function required?
IIRC, the reason why the helper function was introduced in other tests is that the helper method does not accept args
and kwargs
because scripted-function do not support them.
From that viewpoint, this helper function is not required.
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.
My experience is that if not using helper function, the arguments with default values need to be given explicitly. In that case, is it good to put all arguments in the inputs
?
@@ -582,6 +583,35 @@ def test_rnnt_loss_costs_and_gradients_random_data_with_numpy_fp32(self): | |||
ref_costs, ref_gradients = rnnt_utils.compute_with_numpy_transducer(data=data) | |||
self._test_costs_and_gradients(data=data, ref_costs=ref_costs, ref_gradients=ref_gradients) | |||
|
|||
def test_psd(self): |
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.
Can you add a docstring?
@nateanl has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
b780ceb
to
380ad3c
Compare
@nateanl has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: This PR adds ``psd`` method to ``torchaudio.functional``. It computes the power spectral density (PSD) matrix of the complex-valued spectrum. The method also supports normalization of Time-Frequency mask. Pull Request resolved: pytorch#2227 Reviewed By: mthrok Differential Revision: D34473908 Pulled By: nateanl fbshipit-source-id: c1cfc584085d77881b35d41d76d39b26fca1dda9
This PR adds
psd
method totorchaudio.functional
.It computes the power spectral density (PSD) matrix of the complex-valued spectrum.
The method also supports normalization of Time-Frequency mask.