| 894 | //--- Decoder Layer |
| 895 | struct DecoderLayer{ |
| 896 | explicit DecoderLayer(DyNetModel* mod, TransformerConfig& tfc) |
| 897 | :_self_attention_sublayer(mod, tfc, true) |
| 898 | , _src_attention_sublayer(mod, tfc) |
| 899 | , _feed_forward_sublayer(mod, tfc) |
| 900 | { |
| 901 | // initialisation for layer normalisation |
| 902 | _p_ln1_g = mod->add_parameters({tfc._num_units}, dynet::ParameterInitConst(1.f)); |
| 903 | _p_ln1_b = mod->add_parameters({tfc._num_units}, dynet::ParameterInitConst(0.f)); |
| 904 | _p_ln2_g = mod->add_parameters({tfc._num_units}, dynet::ParameterInitConst(1.f)); |
| 905 | _p_ln2_b = mod->add_parameters({tfc._num_units}, dynet::ParameterInitConst(0.f)); |
| 906 | _p_ln3_g = mod->add_parameters({tfc._num_units}, dynet::ParameterInitConst(1.f)); |
| 907 | _p_ln3_b = mod->add_parameters({tfc._num_units}, dynet::ParameterInitConst(0.f)); |
| 908 | |
| 909 | _p_tfc = &tfc; |
| 910 | } |
| 911 | |
| 912 | ~DecoderLayer(){} |
| 913 |
nothing calls this directly
no test coverage detected