Commit afbdd24
committed
Use torch.accelerator API in Fast Neural Style example
`torch.accelerator` API allows to abstract some of the accelerator specifics
in the user scripts. This commit modifies Fast Neural Style example with the mentioned API.
Things to note:
* Commit modifies example command line by replacing accelerator specific
flags (`--cuda`, `--mps`, `--xpu`) with the --accel
* `torch.accelerator` API appeared in pytorch 2.6, so commit binds example to this torch version
* Commit introduces `USE_ACCEL` flag for the test `*.sh` script. At the moment this
flag is just an alias for `USE_CUDA`. In the future it should replace `USE_CUDA` once all
examples will be converted to use `torch.accelerator` API.
Signed-off-by: Dmitry Rogozhkin <[email protected]>1 parent 00ef8a7 commit afbdd24
File tree
4 files changed
+37
-39
lines changed- fast_neural_style
- neural_style
4 files changed
+37
-39
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
| 29 | + | |
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
36 | | - | |
| 34 | + | |
37 | 35 | | |
38 | 36 | | |
39 | 37 | | |
40 | 38 | | |
41 | 39 | | |
42 | 40 | | |
43 | 41 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
47 | 45 | | |
48 | 46 | | |
49 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 32 | + | |
| 33 | + | |
38 | 34 | | |
39 | 35 | | |
40 | 36 | | |
41 | | - | |
| 37 | + | |
42 | 38 | | |
43 | 39 | | |
44 | 40 | | |
| |||
129 | 125 | | |
130 | 126 | | |
131 | 127 | | |
132 | | - | |
133 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
134 | 132 | | |
135 | | - | |
| 133 | + | |
136 | 134 | | |
137 | 135 | | |
138 | 136 | | |
| |||
212 | 210 | | |
213 | 211 | | |
214 | 212 | | |
215 | | - | |
216 | | - | |
| 213 | + | |
| 214 | + | |
217 | 215 | | |
218 | 216 | | |
219 | 217 | | |
| |||
226 | 224 | | |
227 | 225 | | |
228 | 226 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | 227 | | |
234 | 228 | | |
235 | 229 | | |
| |||
240 | 234 | | |
241 | 235 | | |
242 | 236 | | |
243 | | - | |
244 | | - | |
245 | 237 | | |
246 | 238 | | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
| 239 | + | |
| 240 | + | |
252 | 241 | | |
253 | 242 | | |
254 | 243 | | |
255 | 244 | | |
256 | 245 | | |
257 | 246 | | |
258 | | - | |
259 | | - | |
| 247 | + | |
| 248 | + | |
260 | 249 | | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
| 250 | + | |
| 251 | + | |
265 | 252 | | |
266 | 253 | | |
267 | 254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
| |||
27 | 33 | | |
28 | 34 | | |
29 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
30 | 41 | | |
31 | 42 | | |
32 | 43 | | |
33 | 44 | | |
34 | 45 | | |
35 | 46 | | |
| 47 | + | |
36 | 48 | | |
37 | 49 | | |
38 | 50 | | |
39 | 51 | | |
40 | 52 | | |
| 53 | + | |
41 | 54 | | |
42 | 55 | | |
43 | 56 | | |
| |||
56 | 69 | | |
57 | 70 | | |
58 | 71 | | |
59 | | - | |
| 72 | + | |
60 | 73 | | |
61 | 74 | | |
62 | 75 | | |
| |||
0 commit comments