Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_mnist.py RuntimeError: OrderedDict mutated during iteration #1

Open
DSleee opened this issue May 19, 2020 · 2 comments
Open

test_mnist.py RuntimeError: OrderedDict mutated during iteration #1

DSleee opened this issue May 19, 2020 · 2 comments

Comments

@DSleee
Copy link

DSleee commented May 19, 2020

Hello,
I tried to run iunet using a test_mnist file.
But this error occurred. How can I solve this error?

RuntimeError Traceback (most recent call last)
in
3 x, y = padding(x.to(device)), y.to(device)
4 optimizer.zero_grad()
----> 5 output = model(x)
6 loss = loss_fn(output, y)
7 loss.backward()
/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
538 result = self._slow_forward(*input, **kwargs)
539 else:
--> 540 result = self.forward(*input, **kwargs)
541 for hook in self._forward_hooks.values():
542 hook_result = hook(self, input, result)

/usr/local/lib/python3.6/dist-packages/torch/nn/modules/container.py in forward(self, input)
98 def forward(self, input):
99 for module in self:
--> 100 input = module(input)
101 return input
102

/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
538 result = self._slow_forward(*input, **kwargs)
539 else:
--> 540 result = self.forward(*input, **kwargs)
541 for hook in self._forward_hooks.values():
542 hook_result = hook(self, input, result)

/mnt/dongsoo/RSNA/Models/iUNET/iunets-master/iunets-master/iunets/networks.py in forward(self, x)
186 # RevNet L
187 for j in range(depth):
--> 188 x = self.module_L[i]j
189
190 # Downsampling L

/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
538 result = self._slow_forward(*input, **kwargs)
539 else:
--> 540 result = self.forward(*input, **kwargs)
541 for hook in self._forward_hooks.values():
542 hook_result = hook(self, input, result)

/usr/local/lib/python3.6/dist-packages/memcnn/models/revop.py in forward(self, *xin)
162 self.num_bwd_passes,
163 len(xin),
--> 164 *(xin + tuple([p for p in self._fn.parameters() if p.requires_grad])))
165 if not self.keep_input:
166 if not pytorch_version_one_and_above:

/usr/local/lib/python3.6/dist-packages/memcnn/models/revop.py in forward(ctx, fn, fn_inverse, keep_input, num_bwd_passes, num_inputs, *inputs_and_weights)
26 # Makes a detached copy which shares the storage
27 x = [element.detach() for element in inputs]
---> 28 outputs = ctx.fn(*x)
29
30 if not isinstance(outputs, tuple):

RuntimeError: OrderedDict mutated during iteration

@cetmann
Copy link
Owner

cetmann commented May 19, 2020

Hi! That's weird. To be honest I haven't run the test_mnist.py in a while. I'll give it another look in the next few days, but can't promise anything before the NeurIPS deadline, after which I wanted to work on the code anyway (more documentation, bugfixes etc).
Best,
Christian

@doer-hjh
Copy link

doer-hjh commented Jun 7, 2020

Hello,
I'd like to reproduce your code about Brain Tumor Segmentation, how should I operate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants