Skip to content

Commit

Permalink
add magic slot for dtensor
Browse files Browse the repository at this point in the history
Signed-off-by: weiwee <wbwmat@gmail.com>
  • Loading branch information
sagewe committed Jun 19, 2023
1 parent 3552824 commit f4ea541
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 100 deletions.
14 changes: 0 additions & 14 deletions python/fate/arch/context/io/model/__init__.py

This file was deleted.

40 changes: 0 additions & 40 deletions python/fate/arch/context/io/model/file.py

This file was deleted.

46 changes: 0 additions & 46 deletions python/fate/arch/context/io/model/http.py

This file was deleted.

30 changes: 30 additions & 0 deletions python/fate/arch/tensor/distributed/_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,36 @@ def __torch_function__(cls, func, types, args=(), kwargs=None):
def __init__(self, shardings: "Shardings") -> None:
self.shardings = shardings

def __add__(self, other):
return torch.add(self, other)

def __radd__(self, other):
return torch.add(other, self)

def __sub__(self, other):
return torch.sub(self, other)

def __rsub__(self, other):
return torch.rsub(self, other)

def __mul__(self, other):
return torch.mul(self, other)

def __rmul__(self, other):
return torch.mul(other, self)

def __truediv__(self, other):
return torch.div(self, other)

def __rtruediv__(self, other):
return torch.div(other, self)

def __matmul__(self, other):
return torch.matmul(self, other)

def __rmatmul__(self, other):
return torch.matmul(other, self)

@property
def shape(self):
return self.shardings.shape
Expand Down

0 comments on commit f4ea541

Please sign in to comment.