From 2e2e76fb88343b23be0a0e2e17b07fbe888b723a Mon Sep 17 00:00:00 2001 From: yaohwang Date: Fri, 17 Jan 2025 10:23:33 +0800 Subject: [PATCH] Fix: lecture_014 mask on offs --- lecture_014/A_Practitioners_Guide_to_Triton.ipynb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lecture_014/A_Practitioners_Guide_to_Triton.ipynb b/lecture_014/A_Practitioners_Guide_to_Triton.ipynb index af4503e..ff20146 100644 --- a/lecture_014/A_Practitioners_Guide_to_Triton.ipynb +++ b/lecture_014/A_Practitioners_Guide_to_Triton.ipynb @@ -423,14 +423,14 @@ " mask = offs < n # <- this is a vector of bools!\n", " \n", " # read data\n", - " x_values = x[offs] # <- a vector is read!\n", - " y_values = y[offs] # <- a vector is read!\n", + " x_values = x[offs[mask]] # <- a vector is read!\n", + " y_values = y[offs[mask]] # <- a vector is read!\n", " \n", " # do operation\n", " z_value = x_value + y_value # <- vectors are added!\n", " \n", " # write data\n", - " z[offs] = z_value # <- a vector is written!" + " z[offs[mask]] = z_value # <- a vector is written!" ] }, {