Skip to content

Commit

Permalink
Fix ModuleDict/ParameterDict in combination with `torch.jit.scrip…
Browse files Browse the repository at this point in the history
…t` (#9424)

Fixes #9401
  • Loading branch information
rusty1s authored Jun 14, 2024
1 parent f0fa9bf commit 1f5e201
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions torch_geometric/nn/module_dict.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Final, Iterable, Mapping, Optional, Set, Tuple, Union
from typing import Final, Iterable, Mapping, Optional, Tuple, Union

import torch
from torch.nn import Module
Expand All @@ -11,7 +11,7 @@
# internal representation and converts it back to `.` in the external
# representation. It also allows passing tuples as keys.
class ModuleDict(torch.nn.ModuleDict):
CLASS_ATTRS: Final[Set[str]] = set(dir(torch.nn.ModuleDict))
CLASS_ATTRS: Final[Tuple[str, ...]] = tuple(dir(torch.nn.ModuleDict))

def __init__(
self,
Expand Down
4 changes: 2 additions & 2 deletions torch_geometric/nn/parameter_dict.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Final, Iterable, Mapping, Optional, Set, Tuple, Union
from typing import Final, Iterable, Mapping, Optional, Tuple, Union

import torch
from torch.nn import Parameter
Expand All @@ -11,7 +11,7 @@
# internal representation and converts it back to `.` in the external
# representation. It also allows passing tuples as keys.
class ParameterDict(torch.nn.ParameterDict):
CLASS_ATTRS: Final[Set[str]] = set(dir(torch.nn.ParameterDict))
CLASS_ATTRS: Final[Tuple[str, ...]] = set(dir(torch.nn.ParameterDict))

def __init__(
self,
Expand Down

0 comments on commit 1f5e201

Please sign in to comment.