Exemplo n.º 1
0
 def input_types(self):
     """Returns definitions of module input ports.
     """
     return {
         "log_probs": NeuralType(("B", "T", "D"), LogprobsType()),
         "log_probs_length": NeuralType(tuple("B"), LengthsType()),
     }
Exemplo n.º 2
0
Arquivo: rnnt.py Projeto: sycomix/NeMo
 def output_types(self):
     return {
         "outputs": NeuralType(('B', 'T', 'T', 'D'), LogprobsType()),
         "prednet_lengths": NeuralType(tuple('B'), LengthsType()),
         "output-states-1": NeuralType((('D', 'B', 'D')), ElementType()),
         "output-states-2": NeuralType((('D', 'B', 'D')), ElementType()),
     }
Exemplo n.º 3
0
 def output_types(self):
     """ Returns definitions of module output ports. """
     return {
         "predictions":
         NeuralType(axes=(AxisType(kind=AxisKind.Batch),
                          AxisType(kind=AxisKind.Dimension)),
                    elements_type=LogprobsType())
     }
Exemplo n.º 4
0
 def input_types(self):
     """ Returns definitions of module input ports. """
     return {
         "predictions":
         NeuralType(axes=('B', 'ANY'), elements_type=LogprobsType()),
         "targets":
         NeuralType(axes=('B'), elements_type=ClassificationTarget()),
     }
Exemplo n.º 5
0
 def input_types(self):
     """Returns definitions of module input ports.
     """
     return {
         "log_probs": NeuralType(("B", "T", "D"), LogprobsType()),
         "labels": NeuralType(("B", "T"), LabelsType()),
         "output_mask": NeuralType(("B", "T"), MaskType(), optional=True),
     }
Exemplo n.º 6
0
 def output_types(self) -> Optional[Dict[str, NeuralType]]:
     """
     Returns definitions of module output ports.
     """
     if not self.log_softmax:
         return {"logits": NeuralType(('B', 'T', 'C'), LogitsType())}
     else:
         return {"log_probs": NeuralType(('B', 'T', 'C'), LogprobsType())}
Exemplo n.º 7
0
 def input_types(self):
     """Input types definitions for LatticeLoss.
     """
     return {
         "log_probs": NeuralType(("B", "T", "D"), LogprobsType()),
         "targets": NeuralType(("B", "T"), LabelsType()),
         "input_lengths": NeuralType(tuple("B"), LengthsType()),
         "target_lengths": NeuralType(tuple("B"), LengthsType()),
     }
Exemplo n.º 8
0
 def input_types(self):
     """Input types definitions for CTCLoss.
     """
     return {
         "log_probs": NeuralType(('B', 'T', 'T', 'D'), LogprobsType()),
         "targets": NeuralType(('B', 'T'), LabelsType()),
         "input_lengths": NeuralType(tuple('B'), LengthsType()),
         "target_lengths": NeuralType(tuple('B'), LengthsType()),
     }
Exemplo n.º 9
0
 def output_ports(self):
     """
     Returns definitions of module output ports.
     """
     # Prepare list of axes.
     axes = [AxisType(kind=AxisKind.Batch)]
     for size in self._sizes[1:]:
         axes.append(AxisType(kind=AxisKind.Any, size=size))
     # Return neural type.
     # TODO: if self._type != "logsoftmax"
     return {"outputs": NeuralType(axes, LogprobsType())}
Exemplo n.º 10
0
 def input_types(self):
     """Input types definitions for Contrastive.
     """
     return {
         "spec_masks": NeuralType(("B", "D", "T"), SpectrogramType()),
         "decoder_outputs": NeuralType(("B", "T", "D"), LogprobsType()),
         "targets": NeuralType(('B', 'T'), LabelsType()),
         "decoder_lengths": NeuralType(tuple('B'),
                                       LengthsType(),
                                       optional=True),
         "target_lengths": NeuralType(tuple('B'),
                                      LengthsType(),
                                      optional=True),
     }
Exemplo n.º 11
0
Arquivo: rnnt.py Projeto: sycomix/NeMo
    def output_types(self):
        """Returns definitions of module output ports.
        """
        if not self._fuse_loss_wer:
            return {
                "outputs": NeuralType(('B', 'T', 'T', 'D'), LogprobsType()),
            }

        else:
            return {
                "loss": NeuralType(elements_type=LossType(), optional=True),
                "wer": NeuralType(elements_type=ElementType(), optional=True),
                "wer_numer": NeuralType(elements_type=ElementType(), optional=True),
                "wer_denom": NeuralType(elements_type=ElementType(), optional=True),
            }
Exemplo n.º 12
0
 def output_types(self) -> Optional[Dict[str, NeuralType]]:
     return {
         "outputs": NeuralType(('B', 'T', 'D'), LogprobsType()),
         "encoded_lengths": NeuralType(tuple('B'), LengthsType()),
         "greedy_predictions": NeuralType(('B', 'T'), LabelsType()),
     }
Exemplo n.º 13
0
 def output_types(self):
     return OrderedDict(
         {"logprobs": NeuralType(('B', 'T', 'D'), LogprobsType())})
Exemplo n.º 14
0
 def input_ports(self):
     """Returns:
         Definitions of module input ports.
     """
     return {"log_probs": NeuralType(('B', 'T', 'D'), LogprobsType())}
Exemplo n.º 15
0
 def output_types(self) -> Optional[Dict[str, NeuralType]]:
     if not self.log_softmax:
         return {"logits": NeuralType(('B', 'D'), LogitsType())}
     else:
         return {"log_probs": NeuralType(('B', 'D'), LogprobsType())}