pytorch构建泛化能力的全连接层

    #  Linear -> Norm -> ReLu -> Dropout -> Linear;

    self.middel_norm = nn.LayerNorm(input.size()[1:], elementwise_affine=False) # batch * vec_dim, norm for vec_dim
    self.middel_relu = nn.ReLU()
    self.middle_dropout = nn.Dropout(p=0.2)
    self.middle_linear = nn.Linear(768, 768)

你可能感兴趣的:(pytorch)