code: def compute_forward_prob(self, acts, labels, act_lens, label_lens):
      B, T, U, _ = acts.shape
  
      log_alpha = torch.zeros(B, T, U)
      log_alpha = log_alpha.to(acts.device)
  
      for t in range(T):
          for u in range(U):
              if u == 0:
                  if t == 0:
                      # this is the base case: (t=0, u=0) with log-alpha = 0.
                      log_alpha[:, t, u] = 0.0
                  else:
                      # this is case for (t = 0, u > 0), reached by (t, u - 1)
                      # emitting a blank symbol.
                      log_alpha[:, t, u] = (
                          log_alpha[:, t - 1, u]
                          + acts[:, t - 1, 0, self.blank]
                      )
              else:
                  if t == 0:
                      # in case of (u > 0, t = 0), this is only reached from
                      # (t, u - 1) with a label emission.
                      gathered = torch.gather(
                          acts[:, t, u - 1],
                          dim=1,
                          index=labels[:, u - 1]
                          .view(-1, 1)
                          .type(torch.int64),
                      ).reshape(-1)
                      log_alpha[:, t, u] = log_alpha[
                          :, t, u - 1
                      ] + gathered.to(log_alpha.device)
                  else:
                      # here both t and u are > 0, this state is reachable
                      # with two possibilities: (t - 1, u) with a blank emission
                      # or (t, u - 1) with a label emission.
                      log_alpha[:, t, u] = torch.logsumexp(
                          torch.stack(
                              [
                                  log_alpha[:, t - 1, u]
                                  + acts[:, t - 1, u, self.blank],
                                  log_alpha[:, t, u - 1]
                                  + torch.gather(
                                      acts[:, t, u - 1],
                                      dim=1,
                                      index=labels[:, u - 1]
                                      .view(-1, 1)
                                      .type(torch.int64),
                                  ).reshape(-1),
                              ]
                          ),
                          dim=0,
                      )
  
      log_probs = []
      for b in range(B):
          # here we need to add the final blank emission weights.
          to_append = (
              log_alpha[b, act_lens[b] - 1, label_lens[b]]
              + acts[b, act_lens[b] - 1, label_lens[b], self.blank]
          )
          log_probs.append(to_append)
      log_prob = torch.stack(log_probs)
  
      return log_prob
  
imports: from typing import List
  import torch
  from nemo.core.classes import Loss
  from nemo.core.neural_types import LabelsType, LengthsType, LogprobsType, LossType, NeuralType
label_desc: Use image node_id 5 for calling the RNNTLossPytorch obj's underlying member method code with example usage: obj.compute_forward_prob(acts, labels, act_lens, label_lens) and returns: log_prob