Commit c0702338 authored by Zhaoheng Ni's avatar Zhaoheng Ni Committed by Facebook GitHub Bot
Browse files

Update forced_align document (#3357)

Summary:
- Fix latex formula rendering issue
- Add `devices` and `properties` tags
- Fix grammar

Pull Request resolved: https://github.com/pytorch/audio/pull/3357

Reviewed By: mthrok

Differential Revision: D46068633

Pulled By: nateanl

fbshipit-source-id: 80cb84508396fbcaf81c068228d46a24bb63b975
parent 8a893fb3
...@@ -2610,25 +2610,33 @@ def forced_align( ...@@ -2610,25 +2610,33 @@ def forced_align(
) -> Tuple[torch.Tensor, torch.Tensor]: ) -> Tuple[torch.Tensor, torch.Tensor]:
"""Computes forced alignment given the emissions from a CTC-trained model and a target label. """Computes forced alignment given the emissions from a CTC-trained model and a target label.
.. devices:: CPU CUDA
.. properties:: TorchScript
Args: Args:
log_probs (torch.Tensor): log probability of CTC emission output. log_probs (torch.Tensor): log probability of CTC emission output.
Tensor with dimensions `(T, C)`. where `T` is the input length, Tensor of shape `(T, C)`. where `T` is the input length,
vocabulary is the number of characters in alphabet including blank. `C` is the number of characters in alphabet including blank.
targets (torch.Tensor): Target sequence. Tensor with dimension `(L,)`, targets (torch.Tensor): Target sequence. Tensor of shape `(L,)`,
where `L` is the target length. where `L` is the target length.
input_lengths (torch.Tensor): Lengths of the inputs (max value must each be <= `T`). Tensor with dimension `()`. input_lengths (torch.Tensor): Lengths of the inputs (max value must each be <= `T`). 0-D Tensor (scalar).
target_lengths (torch.Tensor): Lengths of the targets. Tensor with dimension `()`. target_lengths (torch.Tensor): Lengths of the targets. 0-D Tensor (scalar).
blank_id (int, optional): The index of blank symbol in CTC emission. (Default: 0) blank_id (int, optional): The index of blank symbol in CTC emission. (Default: 0)
Returns: Returns:
Tuple(torch.Tensor, torch.Tensor): Tuple(torch.Tensor, torch.Tensor):
torch.Tensor: Label for each time step in the alignemnt path computed using forced alignment. torch.Tensor: Label for each time step in the alignment path computed using forced alignment.
torch.Tensor: Log probability scores of the labels for each time step. torch.Tensor: Log probability scores of the labels for each time step.
Note: Note:
The sequence length of `log_probs` must satisfy: The sequence length of `log_probs` must satisfy:
.. math:: .. math::
L_{\\text{log_probs}} \\ge L_{\\text{label}} + N_{\\text{repeat}} L_{\\text{log\_probs}} \ge L_{\\text{label}} + N_{\\text{repeat}}
where :math:`N_{\\text{repeat}}` is the number of consecutively repeated tokens. where :math:`N_{\\text{repeat}}` is the number of consecutively repeated tokens.
For example, in str `"aabbc"`, the number of repeats are `2`. For example, in str `"aabbc"`, the number of repeats are `2`.
""" """
......
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