当前位置: 首页>>代码示例>>Python>>正文


Python NNBase.grad_check方法代码示例

本文整理汇总了Python中nn.base.NNBase.grad_check方法的典型用法代码示例。如果您正苦于以下问题:Python NNBase.grad_check方法的具体用法?Python NNBase.grad_check怎么用?Python NNBase.grad_check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nn.base.NNBase的用法示例。


在下文中一共展示了NNBase.grad_check方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: grad_check

# 需要导入模块: from nn.base import NNBase [as 别名]
# 或者: from nn.base.NNBase import grad_check [as 别名]
    def grad_check(self, x, y, outfd=sys.stderr, **kwargs):
        """
        Wrapper for gradient check on RNNs;
        ensures that backprop-through-time is run to completion,
        computing the full gradient for the loss as summed over
        the input sequence and predictions.

        Do not modify this function!
        """
        NNBase.grad_check(self, x, y, outfd=outfd, **kwargs)
开发者ID:nishithbsk,项目名称:SentenceGeneration,代码行数:12,代码来源:brnnlm.py

示例2: grad_check

# 需要导入模块: from nn.base import NNBase [as 别名]
# 或者: from nn.base.NNBase import grad_check [as 别名]
 def grad_check(self, x, y, outfd=sys.stderr, **kwargs):
     """
     Wrapper for gradient check on RNNs;
     ensures that backprop-through-time is run to completion,
     computing the full gradient for the loss as summed over
     the input sequence and predictions.
     Do not modify this function!
     """
     bptt_old = self.bptt
     self.bptt = len(y)
     print >> outfd, "NOTE: temporarily setting self.bptt = len(y) = %d to compute true gradient." % self.bptt
     NNBase.grad_check(self, x, y, outfd=outfd, **kwargs)
     self.bptt = bptt_old
     print >> outfd, "Reset self.bptt = %d" % self.bptt
开发者ID:ryu577,项目名称:base,代码行数:16,代码来源:msushkov_rnnlm.py


注:本文中的nn.base.NNBase.grad_check方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。