INNER CODE UNIT · Python

map_nagisa_params

taishi-i/nagisa · nagisa/dynet_loader.py:123

def map_nagisa_params(params, hp):
    """Map parsed parameters onto nagisa's model structure, validating shapes.

    The section order is fixed by Model.__init__ (nagisa/model.py): plain
    parameters appear as the three BiRNNs (ws, pos, char; each with
    2*LAYERS builders of Wx/Wh/b) followed by w_ws, b_ws, w_pos, b_pos;
    lookup parameters appear as UNI, BI, WORD, CTYPE, POS, trans.

    return:
        - dict with keys: UNI, BI, WORD, CTYPE, POS, trans, w_ws, b_ws,
          w_pos, b_pos (numpy arrays) and ws_lstms, pos_lstms, char_lstms
          (lists of (fwd, bwd) dicts with Wx/Wh/b per BiRNN layer).
    """
    layers = hp['LAYERS']
    dim_uni = hp['DIM_UNI']
    dim_hidden = hp['DIM_HIDDEN']
    size_postags = hp['VOCAB_SIZE_POSTAG']
    dim_ws_input = ((dim_uni + hp['DIM_BI'] + hp['DIM_CTYPE']) * hp['WINDOW_SIZE']

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…