Skip to content

Commit 52e9ebb

Browse files
authored
try torch_dispatch method (#2217)
1 parent d1d2398 commit 52e9ebb

File tree

16 files changed

+11734
-0
lines changed

16 files changed

+11734
-0
lines changed

tests/torch4ms/__init__.py

Whitespace-only changes.

tests/torch4ms/test_simple.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import torch4ms
2+
import torch
3+
from torch4ms import MSDispatchMode, MSFunctionMode
4+
import mindspore
5+
6+
dispatch_mode = MSDispatchMode()
7+
function_mode = MSFunctionMode()
8+
9+
dispatch_mode.__enter__()
10+
function_mode.__enter__()
11+
12+
def test_add():
13+
x = torch.tensor(1)
14+
y = torch.tensor(2)
15+
z = x + y
16+
print(z)

torch4ms/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .tensor import *

torch4ms/_op_prim/__init__.py

Whitespace-only changes.

torch4ms/_op_prim/ascend/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)