def build_lm_graph(self, sent):
    dy.renew_cg()
    init_state = self.builder.initial_state()
    R = dy.parameter(self.R)
    bias = dy.parameter(self.bias)
    errs = []
    es = []
    state = init_state
    for (cw, nw) in zip(sent, sent[1:]):
        x_t = dy.lookup(self.lookup, int(cw))
        state = state.add_input(x_t)
        y_t = state.output()
        r_t = (bias + (R * y_t))
        err = dy.pickneglogsoftmax(r_t, int(nw))
        errs.append(err)
    nerr = dy.esum(errs)
    return nerr
def build_lm_graph(self, sent):
    dy.renew_cg()
    init_state = self.builder.initial_state()
    R = dy.parameter(self.R)
    bias = dy.parameter(self.bias)
    errs = []
    es = []
    state = init_state
    for (cw, nw) in zip(sent, sent[1:]):
        x_t = dy.lookup(self.lookup, int(cw))
        state = state.add_input(x_t)
        y_t = state.output()
        r_t = (bias + (R * y_t))
        err = dy.pickneglogsoftmax(r_t, int(nw))
        errs.append(err)
    nerr = dy.esum(errs)
    return nerr