[DOCS] use numel for num_elements in elementwise tutorial (#228)

This commit is contained in:
Sasank Chilamkurthy
2021-08-20 08:05:12 +05:30
committed by GitHub
parent f26a48a3b4
commit 6aa5720d75

View File

@@ -55,7 +55,7 @@ def add(x: torch.Tensor, y: torch.Tensor):
# We need to preallocate the output # We need to preallocate the output
output = torch.empty_like(x) output = torch.empty_like(x)
assert x.is_cuda and y.is_cuda and output.is_cuda 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. # 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] # 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 # In this case, we use a 1D grid where the size is the number of blocks