transform_to_tensor.Rd
Converts a numeric vector, as delivered by the backend, into a torch_tensor
of shape (channels x samples).
If provided by the backend, attributes "channels" and "sample_rate" will be used.
transform_to_tensor(
audio,
out = NULL,
normalization = TRUE,
channels_first = TRUE
)
(numeric): A numeric vector, as delivered by the backend.
(Tensor): An optional output tensor to use instead of creating one. (Default: NULL
)
(bool, float or function): Optional normalization.
If boolean TRUE
, then output is divided by 2^(bits-1)
.
If bits
info is not available it assumes the input is signed 32-bit audio.
If numeric
, then output is divided by that number.
If function
, then the output is passed as a parameter to the given function,
then the output is divided by the result. (Default: TRUE
)
(bool): Set channels first or length first in result. (Default: TRUE
)
list(Tensor, int), containing
- the audio content, encoded as `[C x L]` or `[L x C]` where L is the number of audio frames and
C is the number of channels- the sample rate of the audio (as listed in the metadata of the file)