espnet2.asr.transducer.rnnt_multi_blank.rnnt_multi_blank._RNNTNumba
espnet2.asr.transducer.rnnt_multi_blank.rnnt_multi_blank._RNNTNumba
class espnet2.asr.transducer.rnnt_multi_blank.rnnt_multi_blank._RNNTNumba(*args, **kwargs)
Bases: Function
static backward(ctx, grad_output)
Defines a formula for differentiating the operation with backward mode automatic differentiation (alias to the vjp function).
This function is to be overridden by all subclasses.
It must accept a context ctx
as the first argument, followed by as many outputs as the forward()
returned (None will be passed in for non tensor outputs of the forward function), and it should return as many tensors, as there were inputs to forward()
. Each argument is the gradient w.r.t the given output, and each returned value should be the gradient w.r.t. the corresponding input. If an input is not a Tensor or is a Tensor not requiring grads, you can just pass None as a gradient for that input.
The context can be used to retrieve tensors saved during the forward pass. It also has an attribute ctx.needs_input_grad
as a tuple of booleans representing whether each input needs gradient. E.g., backward()
will have ctx.needs_input_grad[0] = True
if the first input to forward()
needs gradient computated w.r.t. the output.
static forward(ctx, acts, labels, act_lens, label_lens, blank, reduction, fastemit_lambda, clamp)
RNNTNumba Forward.
log_probs: Tensor of (batch x seqLength x labelLength x outputDim) : containing output from network
labels: 2 dimensional Tensor containing all the targets of : the batch with zero padded
act_lens: Tensor of size (batch) containing size of each : output sequence from the network
label_lens: Tensor of (batch) containing label length of each example fastemit_lambda: Float scaling factor for FastEmit regularization. Refer to
FastEmit: Low-latency Streaming ASR with Sequence-level Emission Regularization.