Skip to content

DynUNet different shape in eval mode? #1387

@rijobro

Description

@rijobro

Describe the bug

Line 126 of test_dynunet.py has:

with torch.no_grad():
    blah

but when changing to:

net.eval()
with torch.no_grad():
    blah

the unit test fails with the following error:

  File "test_dynunet.py", line 129, in test_shape
    self.assertEqual(len(results), len(expected_shape))
AssertionError: 1 != 3

Spotted in this PR, which calls eval and no_grad together: #1384.

To Reproduce

  1. run python tests/test_dynunet.py -- all ok
  2. insert net.eval() at line 126 of test_dynunet.py
  3. run python tests/test_dynunet.py -- error

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions