Skip to content
This repository was archived by the owner on Sep 25, 2020. It is now read-only.

ModuleCompose.debug crashes with tuple output of different types #146

@FelixAbrahamsson

Description

@FelixAbrahamsson

For example, the torch.nn.LSTM module output is in the format torch.Tensor, (torch.Tensor, torch.Tensor) which causes ModuleCompose.debug to crash on print_intermediate when it assumes the second item of the output has a shape because the first item does. A proposed quick fix would be changing line 77
from

if hasattr(x[0], 'shape'):

to

if all(map(lambda x: hasattr(x, 'shape'), x)):

Or alternatively we might want to recurse through the output until a non-tuple is reached?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions