Unverified Commit ddd2425c authored by moto's avatar moto Committed by GitHub
Browse files

Add deprecation warnings to magphase and ComplexNorm (#1492)

parent a8fbbdac
......@@ -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
......
# -*- 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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment