Skip to content

Commit 74b98db

Browse files
committed
MAINT: allow cpu and cuda targets in e2e examples
1 parent a2c941f commit 74b98db

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

e2e/mandelbrot/mandelbrot.png

124 KB
Loading

e2e/mandelbrot/mandelbrot.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
#import numpy as np
77
import torch_np as np
88

9+
10+
# To run on CUDA, change "cpu" to "cuda" below.
911
import torch
10-
torch.set_default_device("cuda")
12+
torch.set_default_device("cpu")
13+
1114

1215
# from mandelbrot_numpy_1 import mandelbrot # copy-paste below
1316

e2e/maze/maze_numpy.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212

1313
_np.random.seed(1234)
1414

15+
16+
# To run on CUDA, change "cpu" to "cuda" below.
1517
import torch
16-
torch.set_default_device("cuda")
18+
torch.set_default_device("cpu")
1719

1820

1921
def build_maze(shape=(65,65), complexity=0.75, density = 0.50):

e2e/nn_from_scratch/nn.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
import numpy as _np
55
import torch_np as np
66

7+
# To run on CUDA, change "cpu" to "cuda" below.
78
import torch
8-
torch.set_default_device('cuda')
9+
torch.set_default_device("cpu")
10+
911

1012
# Creating data set
1113

e2e/smoke/smoke_solver.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
"""
1313
import torch_np as np
1414

15+
# To run on CUDA, change "cpu" to "cuda" below.
1516
import torch
16-
torch.set_default_device("cuda")
17+
torch.set_default_device("cpu")
1718

1819

1920
def set_bnd(N, b, x):

0 commit comments

Comments
 (0)