Skip to content

Commit

Permalink
Fix bug in layers.ops.deserialize_scatter (close #347)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielegrattarola committed Mar 11, 2022
1 parent 4aaaff5 commit c1d8878
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions spektral/layers/ops/scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,9 @@ def serialize_scatter(identifier):


def deserialize_scatter(scatter):
if isinstance(scatter, str):
if scatter in OP_DICT:
return OP_DICT[scatter]
else:
if callable(scatter):
return scatter
else:
raise ValueError(
"scatter must be callable or string in: {}.".format(
list(OP_DICT.keys())
)
)
if isinstance(scatter, str) and scatter in OP_DICT:
return OP_DICT[scatter]
elif callable(scatter):
return scatter
else:
raise ValueError(f"scatter must be callable or string: {list(OP_DICT.keys())}")

0 comments on commit c1d8878

Please sign in to comment.