jonathanjordan21's picture
Upload folder using huggingface_hub (#1)
7ce5feb verified
raw
history blame contribute delete
527 Bytes
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
@classmethod
def from_opt(cls, opt, embeddings):
"""Alternate constructor.
Subclasses should override this method.
"""
raise NotImplementedError