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

Bug and/or dead code in modular_network.py? #83

Open
sflc6 opened this issue May 21, 2020 · 1 comment
Open

Bug and/or dead code in modular_network.py? #83

sflc6 opened this issue May 21, 2020 · 1 comment
Assignees

Comments

@sflc6
Copy link
Collaborator

sflc6 commented May 21, 2020

In particular, see here:

# Dict[Dim, SubModule]
# instantiate heads based on output_shapes
head_submodules = {}
for output_key, shape in output_space.items():
dim = len(shape)
if dim in head_submodules:
continue
elif dim == 1:
submod_cls = net_reg.lookup_submodule(args.head1d)
elif dim == 2:
submod_cls = net_reg.lookup_submodule(args.head2d)
elif dim == 3:
submod_cls = net_reg.lookup_submodule(args.head3d)
elif dim == 4:
submod_cls = net_reg.lookup_submodule(args.head4d)
else:
raise ValueError("Invalid dim: {}".format(dim))
submod = submod_cls.from_args(
args,
body_submod.output_shape(submod_cls.dim),
"head" + str(dim) + "d",
)
head_submodules[str(dim)] = submod

In the following if-statement:

if dim in head_submodules:
    continue

type(dim) == int; however, keys of head_submodules are guaranteed to be str due to the line head_submodules[str(dim)] = submod. This suggests that the above if-statement will never continue. Thoughts on this?

@sflc6
Copy link
Collaborator Author

sflc6 commented May 21, 2020

Perhaps we want dim = str(len(shape)) on line 220?

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

2 participants