From 366daaff8010f598f00609f029208642ef235f0d Mon Sep 17 00:00:00 2001 From: Routhleck <1310722434@qq.com> Date: Wed, 15 Nov 2023 10:05:20 +0800 Subject: [PATCH 1/3] Update operator_custom_with_taichi.ipynb --- .../operator_custom_with_taichi.ipynb | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/tutorial_advanced/operator_custom_with_taichi.ipynb b/docs/tutorial_advanced/operator_custom_with_taichi.ipynb index 70a88eeea..2bd297ef7 100644 --- a/docs/tutorial_advanced/operator_custom_with_taichi.ipynb +++ b/docs/tutorial_advanced/operator_custom_with_taichi.ipynb @@ -242,11 +242,11 @@ " vector: ti.types.ndarray(ndim=1), \n", " weight: ti.types.ndarray(ndim=1), \n", " out: ti.types.ndarray(ndim=1)):\n", - " weight_0 = weight[0]\n", - " ti.loop_config(block_dim=64)\n", - " for i, j in ti.ndrange(indices.shape[0], indices.shape[1]):\n", - " if vector[i]:\n", - " out[indices[i, j]] += weight_0\n", + " weight_0 = weight[0]\n", + " ti.loop_config(block_dim=64)\n", + " for ij in ti.grouped(indices):\n", + " if vector[ij[0]]:\n", + " out[ij[1]] += weight_0\n", "\n", "prim = bm.XLACustomOp(cpu_kernel=event_ell_cpu, gpu_kernel=event_ell_gpu)\n", "\n", @@ -503,11 +503,11 @@ " vector: ti.types.ndarray(ndim=1), \n", " weight: ti.types.ndarray(ndim=1), \n", " out: ti.types.ndarray(ndim=1)):\n", - " weight_0 = weight[0]\n", - " ti.loop_config(block_dim=64)\n", - " for i, j in ti.ndrange(indices.shape[0], indices.shape[1]):\n", - " if vector[i]:\n", - " out[indices[i, j]] += weight_0\n", + " weight_0 = weight[0]\n", + " ti.loop_config(block_dim=64)\n", + " for ij in ti.grouped(indices):\n", + " if vector[ij[0]]:\n", + " out[ij[1]] += weight_0\n", "\n", "prim = bm.XLACustomOp(cpu_kernel=event_ell_cpu, gpu_kernel=event_ell_gpu)\n", "\n", From 4bb6718a4bc75855d86d58c1e04f21c7713475b9 Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Thu, 16 Nov 2023 10:44:47 +0800 Subject: [PATCH 2/3] Rename the title in taichi op register tutorial --- docs/tutorial_advanced/operator_custom_with_taichi.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial_advanced/operator_custom_with_taichi.ipynb b/docs/tutorial_advanced/operator_custom_with_taichi.ipynb index 2bd297ef7..734494814 100644 --- a/docs/tutorial_advanced/operator_custom_with_taichi.ipynb +++ b/docs/tutorial_advanced/operator_custom_with_taichi.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Operator Customization with Numba" + "# Operator Customization with Taichi" ] }, { From a3f73df69f2367b3b4acfe2d66caea6c86bb313d Mon Sep 17 00:00:00 2001 From: He Sichao <1310722434@qq.com> Date: Thu, 16 Nov 2023 10:46:00 +0800 Subject: [PATCH 3/3] Update operator_custom_with_taichi.ipynb --- docs/tutorial_advanced/operator_custom_with_taichi.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial_advanced/operator_custom_with_taichi.ipynb b/docs/tutorial_advanced/operator_custom_with_taichi.ipynb index 734494814..183a8a251 100644 --- a/docs/tutorial_advanced/operator_custom_with_taichi.ipynb +++ b/docs/tutorial_advanced/operator_custom_with_taichi.ipynb @@ -18,7 +18,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Brain dynamics is sparse and event-driven, however, proprietary operators for brain dynamics are not well abstracted and summarized. As a result, we are often faced with the need to customize operators. In this tutorial, we will explore how to customize brain dynamics operators using ti.\n", + "Brain dynamics is sparse and event-driven, however, proprietary operators for brain dynamics are not well abstracted and summarized. As a result, we are often faced with the need to customize operators. In this tutorial, we will explore how to customize brain dynamics operators using taichi.\n", "\n", "Start by importing the relevant Python package." ]