Skip to content

Commit bdd3bad

Browse files
committed
fix
Signed-off-by: Anatoly Myachev <[email protected]>
1 parent c55c48f commit bdd3bad

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

python/tutorials/01-vector-add.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ def add_kernel(x_ptr, # *Pointer* to first input vector.
6262
def add(x: torch.Tensor, y: torch.Tensor):
6363
# We need to preallocate the output.
6464
output = torch.empty_like(x)
65-
assert x.device == DEVICE and y.device == DEVICE and output.device == DEVICE
65+
is_dvc = f"is_{DEVICE}"
66+
assert getattr(x, is_dvc) and getattr(y, is_dvc) and getattr(output, is_dvc)
6667
n_elements = output.numel()
6768
# The SPMD launch grid denotes the number of kernel instances that run in parallel.
6869
# It is analogous to CUDA launch grids. It can be either Tuple[int], or Callable(metaparameters) -> Tuple[int].

0 commit comments

Comments
 (0)