Skip to content

Commit 9dbe037

Browse files
committed
[Eager] Add eager mode POC
1 parent 235bb5c commit 9dbe037

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

PyTorchSimDevice/csrc/aten/OpenRegMinimal.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,4 @@ TORCH_LIBRARY_IMPL(_, PrivateUse1, m) {
158158
}
159159
// LITERALINCLUDE END: FALLBACK GLOBAL
160160

161-
// LITERALINCLUDE START: FALLBACK SINGLE
162-
TORCH_LIBRARY_IMPL(aten, PrivateUse1, m) {
163-
m.impl(
164-
"sub.Tensor",
165-
torch::CppFunction::makeFromBoxedFunction<&wrapper_cpu_fallback>());
166-
}
167-
// LITERALINCLUDE END: FALLBACK SINGLE
168-
169161
} // namespace at::openreg

tests/test_eager.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import torch
22

3+
@torch.library.impl("aten::mul.Tensor", "npu")
4+
def my_fallback(x, y):
5+
raise NotImplementedError("Fallback called")
6+
37
if __name__ == "__main__":
8+
#torch.npu.register_fallback_op("aten::add.out", my_fallback)
49
device = torch.device("npu:0")
5-
x = torch.zeros(10, 10).to(device)
6-
y = torch.zeros(10, 10).to(device)
7-
z = x + y
10+
x = torch.ones(10, 10).to(device)
11+
y = torch.ones(10, 10).to(device)
12+
z = x * y
813
print(z.cpu())

0 commit comments

Comments
 (0)