Skip to content

Commit 327ac78

Browse files
wincent8mengfei25yucai-intelCuiYifengCopilot
authored
port test_sparse and test_sparse_csr for Intel GPU (#2252)
Case num change: |test file|increased total|increased pass|increased skipped| |-|-|-|-| |test/xpu/test_sparse_xpu.py|5800|4425|1724| |test/xpu/test_sparse_csr_xpu.py|9892|8101|1791| disable_distributed disable_e2e --------- Co-authored-by: mengfei25 <[email protected]> Co-authored-by: yucai-intel <[email protected]> Co-authored-by: Cui, Yifeng <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: chunhuanMeng <[email protected]> Co-authored-by: xiangdong <[email protected]>
1 parent 2a568ed commit 327ac78

20 files changed

+35269
-58
lines changed
Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
# shape: torch.Size([])
2+
# nnz: 2
3+
# sparse_dim: 0
4+
# indices shape: torch.Size([0, 2])
5+
# values shape: torch.Size([2])
6+
########## torch.int32 ##########
7+
# sparse tensor
8+
tensor(indices=tensor([], size=(0, 2)),
9+
values=tensor([0, 1]),
10+
size=(), nnz=2, dtype=torch.int32, layout=torch.sparse_coo)
11+
# _indices
12+
tensor([], size=(0, 2), dtype=torch.int64)
13+
# _values
14+
tensor([0, 1], dtype=torch.int32)
15+
########## torch.float32 ##########
16+
# sparse tensor
17+
tensor(indices=tensor([], size=(0, 2)),
18+
values=tensor([0., 1.]),
19+
size=(), nnz=2, layout=torch.sparse_coo)
20+
# after requires_grad_
21+
tensor(indices=tensor([], size=(0, 2)),
22+
values=tensor([0., 1.]),
23+
size=(), nnz=2, layout=torch.sparse_coo, requires_grad=True)
24+
# after addition
25+
tensor(indices=tensor([], size=(0, 2)),
26+
values=tensor([0., 2.]),
27+
size=(), nnz=2, layout=torch.sparse_coo, grad_fn=<AddBackward0>)
28+
# _indices
29+
tensor([], size=(0, 2), dtype=torch.int64)
30+
# _values
31+
tensor([0., 1.])
32+
33+
# shape: torch.Size([0])
34+
# nnz: 10
35+
# sparse_dim: 0
36+
# indices shape: torch.Size([0, 10])
37+
# values shape: torch.Size([10, 0])
38+
########## torch.int32 ##########
39+
# sparse tensor
40+
tensor(indices=tensor([], size=(0, 10)),
41+
values=tensor([], size=(10, 0)),
42+
size=(0,), nnz=10, dtype=torch.int32, layout=torch.sparse_coo)
43+
# _indices
44+
tensor([], size=(0, 10), dtype=torch.int64)
45+
# _values
46+
tensor([], size=(10, 0), dtype=torch.int32)
47+
########## torch.float64 ##########
48+
# sparse tensor
49+
tensor(indices=tensor([], size=(0, 10)),
50+
values=tensor([], size=(10, 0)),
51+
size=(0,), nnz=10, dtype=torch.float64, layout=torch.sparse_coo)
52+
# after requires_grad_
53+
tensor(indices=tensor([], size=(0, 10)),
54+
values=tensor([], size=(10, 0)),
55+
size=(0,), nnz=10, dtype=torch.float64, layout=torch.sparse_coo,
56+
requires_grad=True)
57+
# after addition
58+
tensor(indices=tensor([], size=(0, 10)),
59+
values=tensor([], size=(10, 0)),
60+
size=(0,), nnz=10, dtype=torch.float64, layout=torch.sparse_coo,
61+
grad_fn=<AddBackward0>)
62+
# _indices
63+
tensor([], size=(0, 10), dtype=torch.int64)
64+
# _values
65+
tensor([], size=(10, 0), dtype=torch.float64)
66+
67+
# shape: torch.Size([2])
68+
# nnz: 3
69+
# sparse_dim: 0
70+
# indices shape: torch.Size([0, 3])
71+
# values shape: torch.Size([3, 2])
72+
########## torch.int32 ##########
73+
# sparse tensor
74+
tensor(indices=tensor([], size=(0, 3)),
75+
values=tensor([[0, 0],
76+
[0, 1],
77+
[1, 1]]),
78+
size=(2,), nnz=3, dtype=torch.int32, layout=torch.sparse_coo)
79+
# _indices
80+
tensor([], size=(0, 3), dtype=torch.int64)
81+
# _values
82+
tensor([[0, 0],
83+
[0, 1],
84+
[1, 1]], dtype=torch.int32)
85+
########## torch.float32 ##########
86+
# sparse tensor
87+
tensor(indices=tensor([], size=(0, 3)),
88+
values=tensor([[0.0000, 0.3333],
89+
[0.6667, 1.0000],
90+
[1.3333, 1.6667]]),
91+
size=(2,), nnz=3, layout=torch.sparse_coo)
92+
# after requires_grad_
93+
tensor(indices=tensor([], size=(0, 3)),
94+
values=tensor([[0.0000, 0.3333],
95+
[0.6667, 1.0000],
96+
[1.3333, 1.6667]]),
97+
size=(2,), nnz=3, layout=torch.sparse_coo, requires_grad=True)
98+
# after addition
99+
tensor(indices=tensor([], size=(0, 3)),
100+
values=tensor([[0.0000, 0.6667],
101+
[1.3333, 2.0000],
102+
[2.6667, 3.3333]]),
103+
size=(2,), nnz=3, layout=torch.sparse_coo, grad_fn=<AddBackward0>)
104+
# _indices
105+
tensor([], size=(0, 3), dtype=torch.int64)
106+
# _values
107+
tensor([[0.0000, 0.3333],
108+
[0.6667, 1.0000],
109+
[1.3333, 1.6667]])
110+
111+
# shape: torch.Size([100, 3])
112+
# nnz: 3
113+
# sparse_dim: 1
114+
# indices shape: torch.Size([1, 3])
115+
# values shape: torch.Size([3, 3])
116+
########## torch.int32 ##########
117+
# sparse tensor
118+
tensor(indices=tensor([[0, 1, 2]]),
119+
values=tensor([[0, 0, 0],
120+
[0, 0, 1],
121+
[1, 1, 1]]),
122+
size=(100, 3), nnz=3, dtype=torch.int32, layout=torch.sparse_coo)
123+
# _indices
124+
tensor([[0, 1, 2]])
125+
# _values
126+
tensor([[0, 0, 0],
127+
[0, 0, 1],
128+
[1, 1, 1]], dtype=torch.int32)
129+
########## torch.float64 ##########
130+
# sparse tensor
131+
tensor(indices=tensor([[0, 1, 2]]),
132+
values=tensor([[0.0000, 0.2222, 0.4444],
133+
[0.6667, 0.8889, 1.1111],
134+
[1.3333, 1.5556, 1.7778]]),
135+
size=(100, 3), nnz=3, dtype=torch.float64, layout=torch.sparse_coo)
136+
# after requires_grad_
137+
tensor(indices=tensor([[0, 1, 2]]),
138+
values=tensor([[0.0000, 0.2222, 0.4444],
139+
[0.6667, 0.8889, 1.1111],
140+
[1.3333, 1.5556, 1.7778]]),
141+
size=(100, 3), nnz=3, dtype=torch.float64, layout=torch.sparse_coo,
142+
requires_grad=True)
143+
# after addition
144+
tensor(indices=tensor([[0, 1, 2]]),
145+
values=tensor([[0.0000, 0.4444, 0.8889],
146+
[1.3333, 1.7778, 2.2222],
147+
[2.6667, 3.1111, 3.5556]]),
148+
size=(100, 3), nnz=3, dtype=torch.float64, layout=torch.sparse_coo,
149+
grad_fn=<AddBackward0>)
150+
# _indices
151+
tensor([[0, 1, 2]])
152+
# _values
153+
tensor([[0.0000, 0.2222, 0.4444],
154+
[0.6667, 0.8889, 1.1111],
155+
[1.3333, 1.5556, 1.7778]], dtype=torch.float64)
156+
157+
# shape: torch.Size([100, 20, 3])
158+
# nnz: 0
159+
# sparse_dim: 2
160+
# indices shape: torch.Size([2, 0])
161+
# values shape: torch.Size([0, 3])
162+
########## torch.int32 ##########
163+
# sparse tensor
164+
tensor(indices=tensor([], size=(2, 0)),
165+
values=tensor([], size=(0, 3)),
166+
size=(100, 20, 3), nnz=0, dtype=torch.int32, layout=torch.sparse_coo)
167+
# _indices
168+
tensor([], size=(2, 0), dtype=torch.int64)
169+
# _values
170+
tensor([], size=(0, 3), dtype=torch.int32)
171+
########## torch.float32 ##########
172+
# sparse tensor
173+
tensor(indices=tensor([], size=(2, 0)),
174+
values=tensor([], size=(0, 3)),
175+
size=(100, 20, 3), nnz=0, layout=torch.sparse_coo)
176+
# after requires_grad_
177+
tensor(indices=tensor([], size=(2, 0)),
178+
values=tensor([], size=(0, 3)),
179+
size=(100, 20, 3), nnz=0, layout=torch.sparse_coo, requires_grad=True)
180+
# after addition
181+
tensor(indices=tensor([], size=(2, 0)),
182+
values=tensor([], size=(0, 3)),
183+
size=(100, 20, 3), nnz=0, layout=torch.sparse_coo, grad_fn=<AddBackward0>)
184+
# _indices
185+
tensor([], size=(2, 0), dtype=torch.int64)
186+
# _values
187+
tensor([], size=(0, 3))
188+
189+
# shape: torch.Size([10, 0, 3])
190+
# nnz: 3
191+
# sparse_dim: 0
192+
# indices shape: torch.Size([0, 3])
193+
# values shape: torch.Size([3, 10, 0, 3])
194+
########## torch.int32 ##########
195+
# sparse tensor
196+
tensor(indices=tensor([], size=(0, 3)),
197+
values=tensor([], size=(3, 10, 0, 3)),
198+
size=(10, 0, 3), nnz=3, dtype=torch.int32, layout=torch.sparse_coo)
199+
# _indices
200+
tensor([], size=(0, 3), dtype=torch.int64)
201+
# _values
202+
tensor([], size=(3, 10, 0, 3), dtype=torch.int32)
203+
########## torch.float64 ##########
204+
# sparse tensor
205+
tensor(indices=tensor([], size=(0, 3)),
206+
values=tensor([], size=(3, 10, 0, 3)),
207+
size=(10, 0, 3), nnz=3, dtype=torch.float64, layout=torch.sparse_coo)
208+
# after requires_grad_
209+
tensor(indices=tensor([], size=(0, 3)),
210+
values=tensor([], size=(3, 10, 0, 3)),
211+
size=(10, 0, 3), nnz=3, dtype=torch.float64, layout=torch.sparse_coo,
212+
requires_grad=True)
213+
# after addition
214+
tensor(indices=tensor([], size=(0, 3)),
215+
values=tensor([], size=(3, 10, 0, 3)),
216+
size=(10, 0, 3), nnz=3, dtype=torch.float64, layout=torch.sparse_coo,
217+
grad_fn=<AddBackward0>)
218+
# _indices
219+
tensor([], size=(0, 3), dtype=torch.int64)
220+
# _values
221+
tensor([], size=(3, 10, 0, 3), dtype=torch.float64)
222+
223+
# shape: torch.Size([10, 0, 3])
224+
# nnz: 0
225+
# sparse_dim: 0
226+
# indices shape: torch.Size([0, 0])
227+
# values shape: torch.Size([0, 10, 0, 3])
228+
########## torch.int32 ##########
229+
# sparse tensor
230+
tensor(indices=tensor([], size=(0, 0)),
231+
values=tensor([], size=(0, 10, 0, 3)),
232+
size=(10, 0, 3), nnz=0, dtype=torch.int32, layout=torch.sparse_coo)
233+
# _indices
234+
tensor([], size=(0, 0), dtype=torch.int64)
235+
# _values
236+
tensor([], size=(0, 10, 0, 3), dtype=torch.int32)
237+
########## torch.float32 ##########
238+
# sparse tensor
239+
tensor(indices=tensor([], size=(0, 0)),
240+
values=tensor([], size=(0, 10, 0, 3)),
241+
size=(10, 0, 3), nnz=0, layout=torch.sparse_coo)
242+
# after requires_grad_
243+
tensor(indices=tensor([], size=(0, 0)),
244+
values=tensor([], size=(0, 10, 0, 3)),
245+
size=(10, 0, 3), nnz=0, layout=torch.sparse_coo, requires_grad=True)
246+
# after addition
247+
tensor(indices=tensor([], size=(0, 0)),
248+
values=tensor([], size=(0, 10, 0, 3)),
249+
size=(10, 0, 3), nnz=0, layout=torch.sparse_coo, grad_fn=<AddBackward0>)
250+
# _indices
251+
tensor([], size=(0, 0), dtype=torch.int64)
252+
# _values
253+
tensor([], size=(0, 10, 0, 3))

0 commit comments

Comments
 (0)