Transformer架构完整代码

#!/usr/bin/python3.9# -*- coding: utf-8 -*-# @Time: 2023/6/29 10:48# @File: abd_transformer_cyd.py# @Software: PyCharmimport mathimport torchimport collectionsimport numpy as npimport torch.nn as nnfrom copy import deepcopyimport torch.nn