作家
登录

如何用PyTorch实现递归神经网络?

作者: 来源: 2017-04-26 13:03:04 阅读 我要评论

of stacks, one for each example in 
  •         # the batch, that we can pop from independently. The words in 
  •         # each example have already been reversed, so that they can 
  •         # be read from left to right by popping from the end of each 
  •         # list; they have also been prefixed with a null value. 
  •         buffers = [list(torch.split(b.squeeze(1), 1, 0)) 
  •                    for b in torch.split(buffers, 1, 1)] 
  •         # we also need two null values at the bottom of each stack, 
  •         # so we can copy from the nulls in the input; these nulls 
  •         # are all needed so that the tracker can run even if the 
  •         # buffer or stack is empty 
  •         stacks = [[buf[0], buf[0]] for buf in buffers] 
  •         if hasattr(self, 'tracker'): 
  •             self.tracker.reset_state() 
  •         for trans_batch in transitions: 
  •             if hasattr(self, 'tracker'): 
  •                 # I described the Tracker earlier as taking 4 
  •                 # arguments (context_t, b, s1, s2), but here I 
  •                 # provide the stack contents as a single argument 
  •                 # while storing the context inside the Tracker 

  •   推荐阅读

      未来的人们,将会如何看待我们现在的机器人?

    【义务编辑:wangxueyan TEL:(010)68476606】 >>>详细阅读


    本文标题:如何用PyTorch实现递归神经网络?

    地址:http://www.17bianji.com/lsqh/34965.html

    关键词: 探索发现

    乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

    网友点评
    自媒体专栏

    评论

    热度

    精彩导读
    栏目ID=71的表不存在(操作类型=0)