def apply_main_layers(self, inputs, index):
    'GPT2_ML的主体是基于Self-Attention的模块\n        顺序：Att  --> LN --> FFN --> Add --> LN\n        '
    x = inputs
    z = self.layer_norm_conds[0]
    attention_name = ('Transformer-%d-MultiHeadSelfAttention' % index)
    feed_forward_name = ('Transformer-%d-FeedForward' % index)
    attention_mask = self.compute_attention_bias(index)
    (xi, x, arguments) = (x, [x, x, x, attention_mask], {'a_bias': True})
    x = self.apply(inputs=x, layer=MultiHeadAttention, arguments=arguments, heads=self.num_attention_heads, head_size=self.attention_head_size, out_dim=self.hidden_size, key_size=self.attention_key_size, kernel_initializer=self.initializer, name=attention_name)
    x = self.apply(inputs=x, layer=Dropout, rate=self.dropout_rate, name=('%s-Dropout' % attention_name))
    x = self.apply(inputs=[xi, x], layer=Add, name=('%s-Add' % attention_name))
    xi = x
    x = self.apply(inputs=self.simplify([x, z]), layer=LayerNormalization, epsilon=1e-05, conditional=(z is not None), hidden_units=self.layer_norm_conds[1], hidden_activation=self.layer_norm_conds[2], hidden_initializer=self.initializer, name=('%s-Norm-0' % feed_forward_name))
    x = self.apply(inputs=x, layer=FeedForward, units=self.intermediate_size, activation=self.hidden_act, kernel_initializer=self.initializer, name=feed_forward_name)
    x = self.apply(inputs=x, layer=Dropout, rate=self.dropout_rate, name=('%s-Dropout' % feed_forward_name))
    x = self.apply(inputs=[xi, x], layer=Add, name=('%s-Add' % feed_forward_name))
    x = self.apply(inputs=self.simplify([x, z]), layer=LayerNormalization, epsilon=1e-05, conditional=(z is not None), hidden_units=self.layer_norm_conds[1], hidden_activation=self.layer_norm_conds[2], hidden_initializer=self.initializer, name=('%s-Norm-1' % feed_forward_name))
    return x
GPT2_ML的主体是基于Self-Attention的模块
顺序：Att  --> LN --> FFN --> Add --> LN
def apply_main_layers(self, inputs, index):
    'GPT2_ML的主体是基于Self-Attention的模块\n        顺序：Att  --> LN --> FFN --> Add --> LN\n        '
    x = inputs
    z = self.layer_norm_conds[0]
    attention_name = ('Transformer-%d-MultiHeadSelfAttention' % index)
    feed_forward_name = ('Transformer-%d-FeedForward' % index)
    attention_mask = self.compute_attention_bias(index)
    (xi, x, arguments) = (x, [x, x, x, attention_mask], {'a_bias': True})
    x = self.apply(inputs=x, layer=MultiHeadAttention, arguments=arguments, heads=self.num_attention_heads, head_size=self.attention_head_size, out_dim=self.hidden_size, key_size=self.attention_key_size, kernel_initializer=self.initializer, name=attention_name)
    x = self.apply(inputs=x, layer=Dropout, rate=self.dropout_rate, name=('%s-Dropout' % attention_name))
    x = self.apply(inputs=[xi, x], layer=Add, name=('%s-Add' % attention_name))
    xi = x
    x = self.apply(inputs=self.simplify([x, z]), layer=LayerNormalization, epsilon=1e-05, conditional=(z is not None), hidden_units=self.layer_norm_conds[1], hidden_activation=self.layer_norm_conds[2], hidden_initializer=self.initializer, name=('%s-Norm-0' % feed_forward_name))
    x = self.apply(inputs=x, layer=FeedForward, units=self.intermediate_size, activation=self.hidden_act, kernel_initializer=self.initializer, name=feed_forward_name)
    x = self.apply(inputs=x, layer=Dropout, rate=self.dropout_rate, name=('%s-Dropout' % feed_forward_name))
    x = self.apply(inputs=[xi, x], layer=Add, name=('%s-Add' % feed_forward_name))
    x = self.apply(inputs=self.simplify([x, z]), layer=LayerNormalization, epsilon=1e-05, conditional=(z is not None), hidden_units=self.layer_norm_conds[1], hidden_activation=self.layer_norm_conds[2], hidden_initializer=self.initializer, name=('%s-Norm-1' % feed_forward_name))
    return x