Skip to content

Commit 299376b

Browse files
committed
Remove dropping_support
1 parent 229ad6b commit 299376b

File tree

9 files changed

+8
-62
lines changed

9 files changed

+8
-62
lines changed

src/torchaudio/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from torchaudio._internal.module_utils import dropping_io_support, dropping_class_io_support
21
from typing import Union, BinaryIO, Optional, Tuple
32
import os
43
import torch

src/torchaudio/_internal/module_utils.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -101,48 +101,6 @@ def decorator(func):
101101

102102
return decorator
103103

104-
DEPRECATION_MSG = (
105-
"This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. "
106-
"Please see https://github.com/pytorch/audio/issues/3902 for more information."
107-
)
108-
109-
IO_DEPRECATION_MSG = (
110-
"This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. "
111-
"The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. "
112-
"Please see https://github.com/pytorch/audio/issues/3902 for more information."
113-
)
114-
115-
dropping_support = deprecated(DEPRECATION_MSG, version="2.9", remove=True)
116-
117-
def dropping_class_support(c, msg=DEPRECATION_MSG):
118-
c.__init__ = wrap_deprecated(c.__init__, f"{c.__module__}.{c.__name__}", msg, version="2.9", remove=True)
119-
c.__doc__ = f"""DEPRECATED
120-
121-
.. warning::
122-
123-
This class is deprecated from version 2.8. It will be removed in the 2.9 release.
124-
{msg}
125-
{c.__doc__}
126-
"""
127-
128-
UNSUPPORTED.append(c)
129-
return c
130-
131-
def dropping_const_support(c, msg=DEPRECATION_MSG, name=None):
132-
c.__doc__ = f"""[DEPRECATED]
133-
134-
.. warning::
135-
136-
This object is deprecated deprecated from version 2.8. It will be removed in the 2.9 release.
137-
{msg}
138-
{c.__doc__}
139-
"""
140-
return c
141-
142-
dropping_class_io_support = partial(dropping_class_support, msg=IO_DEPRECATION_MSG)
143-
144-
dropping_io_support = deprecated(IO_DEPRECATION_MSG, version="2.9", remove=True)
145-
146104
def fail_with_message(message):
147105
"""Generate decorator to give users message about missing TorchAudio extension."""
148106

src/torchaudio/functional/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
from torchaudio._internal.module_utils import dropping_support
21

3-
from ._alignment import forced_align as _forced_align, merge_tokens, TokenSpan
2+
from ._alignment import forced_align, merge_tokens, TokenSpan
43
from .filtering import (
54
allpass_biquad,
65
band_biquad,
@@ -26,8 +25,6 @@
2625
vad,
2726
)
2827

29-
forced_align = dropping_support(_forced_align)
30-
3128
from .functional import (
3229
add_noise,
3330
amplitude_to_DB,

src/torchaudio/functional/functional.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import torch
1010
import torchaudio
1111
from torch import Tensor
12-
from torchaudio._internal.module_utils import deprecated, dropping_support
12+
from torchaudio._internal.module_utils import deprecated
1313

1414

1515
from .filtering import highpass_biquad, treble_biquad
@@ -1733,7 +1733,7 @@ def backward(ctx, dy):
17331733
result = grad * grad_out;
17341734
return (result, None, None, None, None, None, None, None)
17351735

1736-
def _rnnt_loss(
1736+
def rnnt_loss(
17371737
logits: Tensor,
17381738
targets: Tensor,
17391739
logit_lengths: Tensor,
@@ -1837,9 +1837,6 @@ def psd(
18371837
psd = psd.sum(dim=-3)
18381838
return psd
18391839

1840-
# Expose both deprecated wrapper as well as original because torchscript breaks on
1841-
# wrapped functions.
1842-
rnnt_loss = dropping_support(_rnnt_loss)
18431840

18441841
def _compute_mat_trace(input: torch.Tensor, dim1: int = -1, dim2: int = -2) -> torch.Tensor:
18451842
r"""Compute the trace of a Tensor along ``dim1`` and ``dim2`` dimensions.

src/torchaudio/transforms/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from torchaudio._internal.module_utils import dropping_class_support
21
from ._multi_channel import MVDR, PSD, RTFMVDR, SoudenMVDR
32
from ._transforms import (
43
AddNoise,
@@ -22,7 +21,7 @@
2221
PitchShift,
2322
Preemphasis,
2423
Resample,
25-
RNNTLoss as _RNNTLoss,
24+
RNNTLoss,
2625
SlidingWindowCmn,
2726
SpecAugment,
2827
SpectralCentroid,
@@ -35,8 +34,6 @@
3534
Vol,
3635
)
3736

38-
RNNTLoss = dropping_class_support(_RNNTLoss)
39-
4037
__all__ = [
4138
"AddNoise",
4239
"AmplitudeToDB",

src/torchaudio/transforms/_transforms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from torch.nn.parameter import UninitializedParameter
1111

1212
from torchaudio import functional as F
13-
from torchaudio.functional.functional import _rnnt_loss
13+
from torchaudio.functional.functional import rnnt_loss
1414
from torchaudio.functional.functional import (
1515
_apply_sinc_resample_kernel,
1616
_check_convolve_mode,
@@ -1847,7 +1847,7 @@ def forward(
18471847
Tensor: Loss with the reduction option applied. If ``reduction`` is ``"none"``, then size (batch),
18481848
otherwise scalar.
18491849
"""
1850-
return _rnnt_loss(
1850+
return rnnt_loss(
18511851
logits,
18521852
targets,
18531853
logit_lengths,

src/torchaudio/utils/download.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ def _get_hash(path, hash, chunk_size=1028):
3030
data = file.read(chunk_size)
3131
return m.hexdigest()
3232

33-
from torchaudio._internal.module_utils import dropping_support
34-
3533
def _download_asset(
3634
key: str,
3735
hash: str = "",

test/torchaudio_unittest/common_utils/func_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def torch_script(obj):
88
buffer = io.BytesIO()
99
if hasattr(obj, '__wrapped__'):
1010
# This is hack for those functions which are deprecated with decorators
11-
# like @deprecated or @dropping_support. Adding the decorators breaks
11+
# like @deprecated. Adding the decorators breaks
1212
# TorchScript. We need to unwrap the function to get the original one,
1313
# which make the tests pass, but that's a lie: the public (deprecated)
1414
# function doesn't support torchscript anymore

test/torchaudio_unittest/functional/torchscript_consistency_impl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ def func(tensor):
804804
logit_lengths = torch.tensor([2], device=tensor.device, dtype=torch.int32)
805805
target_lengths = torch.tensor([2], device=tensor.device, dtype=torch.int32)
806806
# This is hack for those functions which are deprecated with decorators
807-
# like @deprecated or @dropping_support. Adding the decorators breaks
807+
# like @deprecated. Adding the decorators breaks
808808
# TorchScript. So here we use the private function which make the tests
809809
# pass, but that's a lie: the public (deprecated) function doesn't
810810
# support torchscript anymore

0 commit comments

Comments
 (0)