问题:
结构图:
问题一:
怎么处理长短不一的情况:padding到最大长度
问题二:
padding的部分在计算attention的时候要加入mask机制 来处理
模型图
数据处理
from __future__ import unicode_literals, print_function, division
from io import open
import unicodedata
import string
import re
import random
import torch
import torch.nn as nn
from torch import optim
import torch.nn.functional as F
import numpy as np
import re
import tensorflow as tf
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from sklearn.model_selection import train_test_split
from tqdm import tqdm
import jieba
from nltk.translate.bleu_score import sentence_bleu
from opencc import OpenCC# 处理英文句子