Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
youkaichao committed Oct 23, 2023
1 parent ef0b64a commit 0c9f0a7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_pytorch/test_dump_function.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import torch

@torch.compile(backend="eager")
def toy_example(a, b):
x = a / (torch.abs(a) + 1)
if b.sum() < 0:
b = b * -1
return x * b

toy_example(torch.randn(10), torch.randn(10))

from depyf.explain import dump_src
src = dump_src(toy_example)
with open("./dump_src_dump_function.py", "w") as f:
f.write(src)

0 comments on commit 0c9f0a7

Please sign in to comment.