Open mthrok opened 3 years ago
I am happy to look at this issue
@mthrok just a reminder that this needs to be deprecated now that we have the RC. I am pinging you to see if it's on your radar - I saw that the other one I work on is: https://github.com/pytorch/audio/issues/1883
The docstrings of
mu_law_encoding
andmu_law_decoding
say the following.https://github.com/pytorch/audio/blob/a8fbbdac1de389cf7799b0abd0684f9b77c2f675/torchaudio/functional/functional.py#L491-L492
And at the beginning of the operation, it performs conversion for non-real-float Tensor into real float.
https://github.com/pytorch/audio/blob/a8fbbdac1de389cf7799b0abd0684f9b77c2f675/torchaudio/functional/functional.py#L502-L503
Note:
is_floating_point()
returnTrue
forhalf
,float
anddouble
types, and returnsFalse
for integer types and complex types, such ascfloat
andcdouble
.If an integer Tensor is passed, then it will be converted to float, but values are retained, so converting to floating point does not help. We should not perform an implicit conversion that still contradicts with the assumption described in docstring and does not align with the expected algorithm.
Suggestion
1. Change the docstring
2. Reject if the input is not real floating type
Of course, with one release cycle of warning.