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

[BC-Breaking] Remove deprecated F.magphase #1934

Merged
merged 2 commits into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions docs/source/functional.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ complex_norm

.. autofunction:: complex_norm

magphase
--------

.. autofunction:: magphase

Copy link
Member

@nateanl nateanl Oct 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blank line needs to be removed, otherwise LGTM.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not hurt and we can fix it in the subsequent PRs, so let's move on. I will merge this PR.

:hidden:`Filtering`
~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 0 additions & 2 deletions torchaudio/functional/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
detect_pitch_frequency,
inverse_spectrogram,
griffinlim,
magphase,
mask_along_axis,
mask_along_axis_iid,
mu_law_encoding,
Expand Down Expand Up @@ -65,7 +64,6 @@
'DB_to_amplitude',
'detect_pitch_frequency',
'griffinlim',
'magphase',
'mask_along_axis',
'mask_along_axis_iid',
'mu_law_encoding',
Expand Down
26 changes: 0 additions & 26 deletions torchaudio/functional/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"mu_law_decoding",
"complex_norm",
"angle",
"magphase",
"phase_vocoder",
'mask_along_axis',
'mask_along_axis_iid',
Expand Down Expand Up @@ -771,31 +770,6 @@ def angle(
return torch.atan2(complex_tensor[..., 1], complex_tensor[..., 0])


@_mod_utils.deprecated(
"Please convert the input Tensor to complex type with `torch.view_as_complex` then "
"use `torch.abs` and `torch.angle`. "
"Please refer to https://github.com/pytorch/audio/issues/1337 "
"for more details about torchaudio's plan to migrate to native complex type.",
version="0.11",
)
def magphase(
complex_tensor: Tensor,
power: float = 1.0
) -> Tuple[Tensor, Tensor]:
r"""Separate a complex-valued spectrogram with shape `(..., 2)` into its magnitude and phase.

Args:
complex_tensor (Tensor): Tensor shape of `(..., complex=2)`
power (float, optional): Power of the norm. (Default: `1.0`)

Returns:
(Tensor, Tensor): The magnitude and phase of the complex tensor
"""
mag = complex_norm(complex_tensor, power)
phase = angle(complex_tensor)
return mag, phase


def phase_vocoder(
complex_specgrams: Tensor,
rate: float,
Expand Down