From 6aa5720d753b05cc0f86c3340936768aa8bac6a5 Mon Sep 17 00:00:00 2001 From: Sasank Chilamkurthy Date: Fri, 20 Aug 2021 08:05:12 +0530 Subject: [PATCH] [DOCS] use numel for num_elements in elementwise tutorial (#228) --- python/tutorials/01-vector-add.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tutorials/01-vector-add.py b/python/tutorials/01-vector-add.py index 5ac5a1225..4baa951c1 100644 --- a/python/tutorials/01-vector-add.py +++ b/python/tutorials/01-vector-add.py @@ -55,7 +55,7 @@ def add(x: torch.Tensor, y: torch.Tensor): # We need to preallocate the output output = torch.empty_like(x) assert x.is_cuda and y.is_cuda and output.is_cuda - n_elements = output.shape[0] + n_elements = output.numel() # The SPMD launch grid denotes the number of kernel instances that run in parallel. # It is analogous to CUDA launch grids. It can be either Tuple[int], or Callable(metaparameters) -> Tuple[int] # In this case, we use a 1D grid where the size is the number of blocks