def __init__(self, vocab,<EOL>word_dims,<EOL>tag_dims,<EOL>dropout_dim,<EOL>lstm_layers,<EOL>lstm_hiddens,<EOL>dropout_lstm_input,<EOL>dropout_lstm_hidden,<EOL>mlp_arc_size,<EOL>mlp_rel_size,<EOL>dropout_mlp,<EOL>debug=False<EOL>):
super(BiaffineParser, self).__init__()<EOL>def embedding_from_numpy(_we, trainable=True):<EOL><INDENT>word_embs = nn.Embedding(_we.shape[<NUM_LIT:0>], _we.shape[<NUM_LIT:1>], weight_initializer=mx.init.Constant(_we))<EOL>apply_weight_drop(word_embs, '<STR_LIT>', dropout_dim, axes=(<NUM_LIT:1>,))<EOL>if not trainable:<EOL><INDENT>word_embs.collect_params().setattr('<STR_LIT>', '<STR_LIT:null>')<EOL><DEDENT>return word_embs<EOL><DEDENT>self._vocab = vocab<EOL>self.word_embs = embedding_from_numpy(vocab.get_word_embs(word_dims))<EOL>self.pret_word_embs = embedding_from_numpy(vocab.get_pret_embs(),<EOL>trainable=False) if vocab.has_pret_embs() else None<EOL>self.tag_embs = embedding_from_numpy(vocab.get_tag_embs(tag_dims))<EOL>self.f_lstm = nn.Sequential()<EOL>self.b_lstm = nn.Sequential()<EOL>self.f_lstm.add(orthonormal_VanillaLSTMBuilder(<NUM_LIT:1>, word_dims + tag_dims, lstm_hiddens, dropout_lstm_input,<EOL>dropout_lstm_hidden, debug))<EOL>self.b_lstm.add(orthonormal_VanillaLSTMBuilder(<NUM_LIT:1>, word_dims + tag_dims, lstm_hiddens, dropout_lstm_input,<EOL>dropout_lstm_hidden, debug))<EOL>for i in range(lstm_layers - <NUM_LIT:1>):<EOL><INDENT>self.f_lstm.add(orthonormal_VanillaLSTMBuilder(<NUM_LIT:1>, <NUM_LIT:2> * lstm_hiddens, lstm_hiddens, dropout_lstm_input,<EOL>dropout_lstm_hidden, debug))<EOL>self.b_lstm.add(orthonormal_VanillaLSTMBuilder(<NUM_LIT:1>, <NUM_LIT:2> * lstm_hiddens, lstm_hiddens, dropout_lstm_input,<EOL>dropout_lstm_hidden, debug))<EOL><DEDENT>self.dropout_lstm_input = dropout_lstm_input<EOL>self.dropout_lstm_hidden = dropout_lstm_hidden<EOL>mlp_size = mlp_arc_size + mlp_rel_size<EOL>W = orthonormal_initializer(mlp_size, <NUM_LIT:2> * lstm_hiddens, debug)<EOL>self.mlp_dep_W = self.parameter_from_numpy('<STR_LIT>', W)<EOL>self.mlp_head_W = self.parameter_from_numpy('<STR_LIT>', W)<EOL>self.mlp_dep_b = self.parameter_init('<STR_LIT>', (mlp_size,), mx.init.Zero())<EOL>self.mlp_head_b = self.parameter_init('<STR_LIT>', (mlp_size,), mx.init.Zero())<EOL>self.mlp_arc_size = mlp_arc_size<EOL>self.mlp_rel_size = mlp_rel_size<EOL>self.dropout_mlp = dropout_mlp<EOL>self.arc_W = self.parameter_init('<STR_LIT>', (mlp_arc_size, mlp_arc_size + <NUM_LIT:1>), init=mx.init.Zero())<EOL>self.rel_W = self.parameter_init('<STR_LIT>', (vocab.rel_size * (mlp_rel_size + <NUM_LIT:1>), mlp_rel_size + <NUM_LIT:1>),<EOL>init=mx.init.Zero())<EOL>self.softmax_loss = SoftmaxCrossEntropyLoss(axis=<NUM_LIT:0>, batch_axis=-<NUM_LIT:1>)<EOL>self.initialize()<EOL>
A MXNet replicate of biaffine parser, see following paper
        Dozat, T., & Manning, C. D. (2016). Deep biaffine attention for neural dependency parsing. arXiv:1611.01734.
        It's a re-implementation of DyNet version https://github.com/jcyk/Dynet-Biaffine-dependency-parser

        Parameters
        ----------
        vocab : ParserVocabulary
            built from a data set
        word_dims : int
            word vector dimension
        tag_dims : int
            tag vector dimension
        dropout_dim : int
            keep rate of word dropout (drop out entire embedding)
        lstm_layers : int
            number of lstm layers
        lstm_hiddens : int
            size of lstm hidden states
        dropout_lstm_input : float
            dropout on x in variational RNN
        dropout_lstm_hidden : float
            dropout on h in variational RNN
        mlp_arc_size : int
            output size of MLP for arc feature extraction
        mlp_rel_size : int
            output size of MLP for rel feature extraction
        dropout_mlp : int
            dropout on the output of LSTM
        debug : bool
            debug mode