Skip to content

Conflict with torch due to overwritten modules #77

@jannisborn

Description

@jannisborn

I'm interested to understand why it is necessary to overwrite the default nn.Module of torch in patch.py:

nn.Module = PatchedModule

This seems to be a quite invasive thing since it alters the behavior of any torch.nn module after torchdrug has been imported.

For example, your implementation of register_buffer in patch.py lacks the keyword argument persistent which is present in native torch: https://github.com/pytorch/pytorch/blob/989b24855efe0a8287954040c89d679625dcabe1/torch/nn/modules/module.py#L277

I would greatly appreciate if you could please let me know how I can fall back to the native torch behavior after having imported torchdrug somewhere above in my code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions