摘要:
import torch.nn as nn from .decoder import Decoder from .encoder import Encoder class Transformer(nn.Module): #定义类,继承父类nn.Module """An encoder-decoder 阅读全文
摘要:
import torch import torch.nn as nn import torch.nn.functional as F from config import IGNORE_ID from .attention import MultiHeadAttention from .module 阅读全文
摘要:
import torch.nn as nn from .attention import MultiHeadAttention #引进多头注意力模块 from .module import PositionalEncoding, PositionwiseFeedForward #位置编码和前馈网络 阅读全文
摘要:
import numpy as np import torch # from torch.utils.tensorboard import SummaryWriter import torch.nn as nn import argparse from tqdm import tqdm from c 阅读全文
摘要:
import argparse #参数解析包 import torch #张量、加减乘除等运算,相当于numpy import torch.nn as nn #包括各种函数 import torch.nn.functional as F #包括激活函数,损失函数等 import torch.opti 阅读全文