Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Torchaudio
Commits
ddd2425c
Unverified
Commit
ddd2425c
authored
May 06, 2021
by
moto
Committed by
GitHub
May 06, 2021
Browse files
Add deprecation warnings to magphase and ComplexNorm (#1492)
parent
a8fbbdac
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
torchaudio/functional/functional.py
torchaudio/functional/functional.py
+6
-0
torchaudio/transforms.py
torchaudio/transforms.py
+9
-0
No files found.
torchaudio/functional/functional.py
View file @
ddd2425c
...
...
@@ -578,6 +578,12 @@ 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."
)
def
magphase
(
complex_tensor
:
Tensor
,
power
:
float
=
1.0
...
...
torchaudio/transforms.py
View file @
ddd2425c
# -*- coding: utf-8 -*-
import
math
import
warnings
from
typing
import
Callable
,
Optional
import
torch
...
...
@@ -673,6 +674,14 @@ class ComplexNorm(torch.nn.Module):
__constants__
=
[
'power'
]
def
__init__
(
self
,
power
:
float
=
1.0
)
->
None
:
warnings
.
warn
(
'torchaudio.transforms.ComplexNorm has been deprecated '
'and will be removed from future release.'
'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."
)
super
(
ComplexNorm
,
self
).
__init__
()
self
.
power
=
power
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment