Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pytorch_lightning/utilities/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def collect_init_args(
if "__class__" in local_vars:
local_args = get_init_args(frame)
# recursive update
path_args.append(local_args)
path_args.insert(0, local_args)
return collect_init_args(frame.f_back, path_args, inside=True)
if not inside:
return collect_init_args(frame.f_back, path_args, inside)
Expand Down
4 changes: 2 additions & 2 deletions tests/tests_pytorch/utilities/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ def __init__(self, anyarg, childarg, anykw=42, childkw=42, **kwargs):
super().__init__(anyarg, anykw=anykw, **kwargs)

my_class = AutomaticArgsChild("test1", "test2", anykw=32, childkw=22, otherkw=123)
assert my_class.result[0] == {"anyarg": "test1", "anykw": 32, "otherkw": 123}
assert my_class.result[1] == {"anyarg": "test1", "childarg": "test2", "anykw": 32, "childkw": 22, "otherkw": 123}
assert my_class.result[0] == {"anyarg": "test1", "childarg": "test2", "anykw": 32, "childkw": 22, "otherkw": 123}
assert my_class.result[1] == {"anyarg": "test1", "anykw": 32, "otherkw": 123}


def test_attribute_dict(tmpdir):
Expand Down