I’m using Pytorch 1.2.0 with Python 3.7, and I can’t enumerate through a ModuleList.
I’m using this code
for i,direction in enumerate(self.directions):
state = states[i]
out, out_state = direction(inp, state)
outputs += [out]
output_states += [out_state]
, which is based from here. and I’m getting
RuntimeError:
'module' object is not iterable:
from
for i,direction in enumerate(self.directions):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... <--- HERE
I’ve clicked the link about enumerating in the original file(the link above), it said that enumerating is already supporterd. Since I can’t use it, can someone please tell me what should I do.
Thanks.