Skip to content

Commit

Permalink
Add conversion test
Browse files Browse the repository at this point in the history
  • Loading branch information
marcromeyn committed Jul 1, 2023
1 parent ddcf3bc commit ab0f635
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/unit/torch/test_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,14 @@ def test_nesting(self):

assert torch.equal(output["shortcut"], inputs)
assert torch.equal(output["output"], inputs + 1)

def test_convert(self):
block = Block(PlusOne())
shortcut = ShortcutBlock(*block)

assert isinstance(shortcut[0], PlusOne)
inputs = torch.rand(5, 5)
assert torch.equal(
module_utils.module_test(shortcut, inputs)["output"],
module_utils.module_test(ShortcutBlock(PlusOne()), inputs)["output"],
)

0 comments on commit ab0f635

Please sign in to comment.