本文整理汇总了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本文标签属性:
示例:示例英文
代码:代码转换器
Python:python菜鸟教程
NNBase:NNBase
grad_check:grad_check