
    hj                     n   S SK JrJrJrJr  S SKrS SKJr  S SKJr	  S SK
Jr  \	R                  " S5      (       a  S SKr/ SQr SS\S	\S
\S\\\\4      4S jjr\\	R&                  " SS5      S\S\\\\4      4S j5       5       r\\	R&                  " SS5      S\S\\\\4      4S j5       5       r\\	R&                  " SS5      S\S\\\\4      4S j5       5       r\\	R&                  " SS5      S\S\\\\4      4S j5       5       r\\	R&                  " SS5      S\S\\\\4      4S j5       5       rg)    )AnyCallableIterableTupleN)Tensor)module_utils)dropping_supportnumpy)read_vec_int_arkread_vec_flt_scpread_vec_flt_arkread_mat_scpread_mat_ark
file_or_fdfnconvert_contiguousreturnc              #      #    U" U 5       H<  u  p4U(       a  [         R                  " U5      nU[        R                  " U5      4v   M>     g7f)a  Takes a method invokes it. The output is converted to a tensor.

Args:
    file_or_fd (str/FileDescriptor): File name or file descriptor
    fn (Callable): Function that has the signature (file name/descriptor) and converts it to
        Iterable[Tuple[str, Tensor]].
    convert_contiguous (bool, optional): Determines whether the array should be converted into a
        contiguous layout. (Default: ``False``)

Returns:
    Iterable[Tuple[str, Tensor]]: The string is the key and the tensor is vec/mat
N)npascontiguousarraytorch
from_numpy)r   r   r   keynp_arrs        K/var/www/auris/envauris/lib/python3.13/site-packages/torchaudio/kaldi_io.py _convert_method_output_to_tensorr      s@      *~))&1F5##F+++ &s   A
Akaldi_ioc                 2    SSK n[        XR                  SS9$ )a  Create generator of (key,vector<int>) tuples, which reads from the ark file/stream.

Args:
    file_or_fd (str/FileDescriptor): ark, gzipped ark, pipe or opened file descriptor

Returns:
    Iterable[Tuple[str, Tensor]]: The string is the key and the tensor is the vector read from file

Example
    >>> # read ark to a 'dictionary'
    >>> d = { u:d for u,d in torchaudio.kaldi_io.read_vec_int_ark(file) }
r   NT)r   )r   r   r   r   r   s     r   r   r   -   s      
 ,J8Q8Qfjkk    c                 4    SSK n[        XR                  5      $ )a  Create generator of (key,vector<float32/float64>) tuples, read according to Kaldi scp.

Args:
    file_or_fd (str/FileDescriptor): scp, gzipped scp, pipe or opened file descriptor

Returns:
    Iterable[Tuple[str, Tensor]]: The string is the key and the tensor is the vector read from file

Example
    >>> # read scp to a 'dictionary'
    >>> # d = { u:d for u,d in torchaudio.kaldi_io.read_vec_flt_scp(file) }
r   N)r   r   r   r   s     r   r   r   E         +J8Q8QRRr    c                 4    SSK n[        XR                  5      $ )a  Create generator of (key,vector<float32/float64>) tuples, which reads from the ark file/stream.

Args:
    file_or_fd (str/FileDescriptor): ark, gzipped ark, pipe or opened file descriptor

Returns:
    Iterable[Tuple[str, Tensor]]: The string is the key and the tensor is the vector read from file

Example
    >>> # read ark to a 'dictionary'
    >>> d = { u:d for u,d in torchaudio.kaldi_io.read_vec_flt_ark(file) }
r   N)r   r   r   r   s     r   r   r   Z   r"   r    c                 4    SSK n[        XR                  5      $ )a  Create generator of (key,matrix<float32/float64>) tuples, read according to Kaldi scp.

Args:
    file_or_fd (str/FileDescriptor): scp, gzipped scp, pipe or opened file descriptor

Returns:
    Iterable[Tuple[str, Tensor]]: The string is the key and the tensor is the matrix read from file

Example
    >>> # read scp to a 'dictionary'
    >>> d = { u:d for u,d in torchaudio.kaldi_io.read_mat_scp(file) }
r   N)r   r   r   r   s     r   r   r   o         +J8M8MNNr    c                 4    SSK n[        XR                  5      $ )a  Create generator of (key,matrix<float32/float64>) tuples, which reads from the ark file/stream.

Args:
    file_or_fd (str/FileDescriptor): ark, gzipped ark, pipe or opened file descriptor

Returns:
    Iterable[Tuple[str, Tensor]]: The string is the key and the tensor is the matrix read from file

Example
    >>> # read ark to a 'dictionary'
    >>> d = { u:d for u,d in torchaudio.kaldi_io.read_mat_ark(file) }
r   N)r   r   r   r   s     r   r   r      r%   r    )F)typingr   r   r   r   r   r   torchaudio._internalr   
_mod_utils!torchaudio._internal.module_utilsr	   is_module_availabler
   r   __all__boolstrr   requires_moduler   r   r   r   r    r    r   <module>r1      s   2 1   ; >!!'** ?D,,!,7;,eCK !,* J0l l%V2D)E l 1 l, J0S S%V2D)E S 1 S& J0S S%V2D)E S 1 S& J0OS OXeCK.@%A O 1 O& J0OS OXeCK.@%A O 1 Or    