parse03.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:nn_parsers 作者: odashi 项目源码 文件源码
def __call__(self, text, wid):
    if text in self.__cache:
      #trace('cache hit: ' + text)
      return self.__cache[text]
    #trace('cache new: ' + text)

    self.__reset_state()
    c_list = [XP.iarray([min(ord(c), 0x7f)]) for c in text]
    x_list = [functions.tanh(self.c_x(c)) for c in c_list]
    for x in x_list:
      f = self.x_f(x)
    for x in reversed(x_list):
      b = self.x_b(x)
    e = functions.tanh(self.w_e(XP.iarray([wid])) + self.f_e(f) + self.b_e(b))
    self.__cache[text] = e
    return e
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号