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

In SubModuleXD, shapes are duplicated within output_shape and _to_xd #81

Open
sflc6 opened this issue May 21, 2020 · 0 comments
Open

In SubModuleXD, shapes are duplicated within output_shape and _to_xd #81

sflc6 opened this issue May 21, 2020 · 0 comments

Comments

@sflc6
Copy link
Collaborator

sflc6 commented May 21, 2020

For example, looking at SubModule2D:

    def output_shape(self, dim=None):
        if dim == 1:
            f, l = self._output_shape
            return (f * l,)
        ...
    ...
    def _to_1d(self, submodule_output):
        """
        :param submodule_output: torch.Tensor (Batch + 2D)
        :return: torch.Tensor (Batch + 1D)
        """
        n, f, l = submodule_output.size()
        return submodule_output.view(n, f * l)

The fact that the 2D -> 1D conversion goes from (F, S) -> (F * S) is indicated in two places within the SubModule2D class. The same is true in general for mD -> nD. It may be worth eliminating this duplication.

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

1 participant