Commit 9bcd60f
[shard] ShardedTensor Interface (pytorch#74695)
Summary:
Pull Request resolved: pytorch#74695
ShardedTensor Interface:
1. Make a ShardedTensorInterface class that is a subclass of torch.Tensor, define basic APIs in ShardedTensorInterface, ShardedTensor is now a subclass of it.
2. By default disable `__torch_dispatch__` in the ShardedTensorInterface, ShardedTensor will use `__torch_function__` for now, subclasses of ShardedTensorInterface can use `__torch_dispatch__` by overriding it
3. remove attribute functions in ShardedTensor and handled them in `__torch_function__`
ghstack-source-id: 155141823
(Note: this ignores all push blocking failures!)
Reviewed By: pritamdamania87, fduwjj
Differential Revision: D35123200
fbshipit-source-id: 04ad48ae373e6f61d48bb3bc83021e97b0721362
(cherry picked from commit 71ad555)1 parent a240d45 commit 9bcd60f
File tree
9 files changed
+202
-138
lines changed- test/distributed/_shard/sharded_tensor
- ops
- torch/distributed/_shard/sharded_tensor
- _ops
9 files changed
+202
-138
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| 195 | + | |
195 | 196 | | |
196 | 197 | | |
197 | 198 | | |
| |||
Lines changed: 15 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
| 424 | + | |
424 | 425 | | |
425 | 426 | | |
426 | 427 | | |
| |||
449 | 450 | | |
450 | 451 | | |
451 | 452 | | |
452 | | - | |
| 453 | + | |
453 | 454 | | |
454 | 455 | | |
455 | 456 | | |
| |||
908 | 909 | | |
909 | 910 | | |
910 | 911 | | |
911 | | - | |
| 912 | + | |
912 | 913 | | |
913 | 914 | | |
914 | 915 | | |
| |||
1025 | 1026 | | |
1026 | 1027 | | |
1027 | 1028 | | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
1028 | 1037 | | |
1029 | 1038 | | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
| 1039 | + | |
1033 | 1040 | | |
1034 | 1041 | | |
1035 | 1042 | | |
| |||
1493 | 1500 | | |
1494 | 1501 | | |
1495 | 1502 | | |
1496 | | - | |
| 1503 | + | |
1497 | 1504 | | |
1498 | 1505 | | |
1499 | 1506 | | |
1500 | 1507 | | |
1501 | 1508 | | |
1502 | 1509 | | |
1503 | 1510 | | |
1504 | | - | |
| 1511 | + | |
1505 | 1512 | | |
1506 | 1513 | | |
1507 | 1514 | | |
| |||
1534 | 1541 | | |
1535 | 1542 | | |
1536 | 1543 | | |
1537 | | - | |
| 1544 | + | |
1538 | 1545 | | |
1539 | 1546 | | |
1540 | 1547 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | 3 | | |
6 | 4 | | |
7 | 5 | | |
| |||
158 | 156 | | |
159 | 157 | | |
160 | 158 | | |
161 | | - | |
| 159 | + | |
162 | 160 | | |
163 | 161 | | |
164 | 162 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 108 | + | |
113 | 109 | | |
114 | 110 | | |
115 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| |||
0 commit comments