MCPcopy Create free account
hub / github.com/clab/dynet / DecoderLayer

Method DecoderLayer

examples/transformer/transformer.h:896–910  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

894//--- Decoder Layer
895struct 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

Callers

nothing calls this directly

Calls 2

ParameterInitConstClass · 0.50
add_parametersMethod · 0.45

Tested by

no test coverage detected