zhuohan123 / g2-lstm

Codes for "Towards Binary-Valued Gates for Robust LSTM Training".
76 stars 12 forks source link

run with bug #3

Closed AigcChangeWorld closed 5 years ago

AigcChangeWorld commented 5 years ago

运行到这一句代码 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

请问这个函数是做什么用的?为什么会出这个错误呢?

AigcChangeWorld commented 5 years ago

版本问题,type(h) == Variable这句应当是0.3版本 自行解决了