Spaces:
Runtime error
Runtime error
| import torch | |
| import torch.nn as nn | |
| from .misc import aeq | |
| class DecoderBase(nn.Module): | |
| """Abstract class for decoders. | |
| Args: | |
| attentional (bool): The decoder returns non-empty attention. | |
| """ | |
| def __init__(self, attentional=True): | |
| super(DecoderBase, self).__init__() | |
| self.attentional = attentional | |
| def from_opt(cls, opt, embeddings): | |
| """Alternate constructor. | |
| Subclasses should override this method. | |
| """ | |
| raise NotImplementedError |