Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 6, 2023
1 parent 1005fe8 commit cc5aa25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion monai/networks/nets/resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def _resnet(
raise KeyError(
"The checkpoint should contain the pretrained model state dict with the following key: 'state_dict'"
)

model.load_state_dict(model_state_dict, strict=True)

return model
Expand Down
10 changes: 5 additions & 5 deletions tests/test_resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,18 +196,18 @@ def test_resnet_pretrained(self, model, input_param, input_shape, expected_shape
"state_dict": net.state_dict()
},
tmp_ckpt_filename)

cp_input_param = copy.copy(input_param)
cp_input_param["pretrained"] = tmp_ckpt_filename
pretrained_net = model(**cp_input_param)
assert str(net.state_dict()) == str(pretrained_net.state_dict())

with self.assertRaises(NotImplementedError):
cp_input_param["pretrained"] = True
bool_pretrained_net = model(**cp_input_param)
model(**cp_input_param)

os.remove(tmp_ckpt_filename)

@parameterized.expand(TEST_SCRIPT_CASES)
def test_script(self, model, input_param, input_shape, expected_shape):
net = model(**input_param)
Expand Down

0 comments on commit cc5aa25

Please sign in to comment.