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
d707b6cd
Unverified
Commit
d707b6cd
authored
Apr 20, 2021
by
Abhishek Anant
Committed by
GitHub
Apr 19, 2021
Browse files
Removed misc_ops, unused internal module (#1465)
parent
b059f087
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
30 deletions
+0
-30
torchaudio/_internal/misc_ops.py
torchaudio/_internal/misc_ops.py
+0
-30
No files found.
torchaudio/_internal/misc_ops.py
deleted
100644 → 0
View file @
b059f087
from
typing
import
Union
,
Callable
import
torch
from
torch
import
Tensor
def
normalize_audio
(
signal
:
Tensor
,
normalization
:
Union
[
bool
,
float
,
Callable
])
->
None
:
"""Audio normalization of a tensor in-place. The normalization can be a bool,
a number, or a callable that takes the audio tensor as an input. SoX uses
32-bit signed integers internally, thus bool normalizes based on that assumption.
"""
if
not
normalization
:
return
if
isinstance
(
normalization
,
bool
):
normalization
=
1
<<
31
if
isinstance
(
normalization
,
(
float
,
int
)):
# normalize with custom value
signal
/=
normalization
elif
callable
(
normalization
):
signal
/=
normalization
(
signal
)
def
check_input
(
src
:
Tensor
)
->
None
:
if
not
torch
.
is_tensor
(
src
):
raise
TypeError
(
'Expected a tensor, got %s'
%
type
(
src
))
if
src
.
is_cuda
:
raise
TypeError
(
'Expected a CPU based tensor, got %s'
%
type
(
src
))
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