运行到这一句代码
def repackage_hidden(h):
"""Wraps hidden states in new Variables, to detach them from their history."""
if type(h) == Variable:
return Variable(h.data)
else:
return tuple(repackage_hidden(v) for v in h)#这一句
raise TypeError('iteration over a 0-d tensor')
TypeError: iteration over a 0-d tensor
运行到这一句代码 def repackage_hidden(h): """Wraps hidden states in new Variables, to detach them from their history.""" if type(h) == Variable: return Variable(h.data) else: return tuple(repackage_hidden(v) for v in h)#这一句
raise TypeError('iteration over a 0-d tensor') TypeError: iteration over a 0-d tensor
请问这个函数是做什么用的?为什么会出这个错误呢?