Skip to content

Commit 33bd4a8

Browse files
committed
Automated tutorials push
1 parent 1a2e559 commit 33bd4a8

File tree

198 files changed

+13083
-13095
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+13083
-13095
lines changed

_downloads/0ccffddcfee1f815c02241b985844376/torch_compile_user_defined_triton_kernel_tutorial.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@ def sin_triton(x):
257257
# Prefer this to using ``torch.autograd.Function`` (which has various composability footguns
258258
# with ``torch.compile``).
259259

260-
def backward(ctx, grad_output):
260+
def backward(ctx, grad):
261261
x, = ctx.saved_tensors
262-
return grad_input * x.cos()
262+
return grad * x.cos()
263263

264264
def setup_context(ctx, inputs, output):
265265
x, = inputs
@@ -293,9 +293,9 @@ def mycos(x: torch.Tensor) -> torch.Tensor:
293293
wrap_triton(cos_kernel)[(n_elements,)](x, out, n_elements, BLOCK_SIZE=4)
294294
return out
295295

296-
def backward(ctx, grad_output):
296+
def backward(ctx, grad):
297297
x, = ctx.saved_tensors
298-
return grad_input * mycos(x)
298+
return grad * mycos(x)
299299

300300
def setup_context(ctx, inputs, output):
301301
x, = inputs

_downloads/f827f181506a79226f4ffbcf7c9a5a50/torch_compile_user_defined_triton_kernel_tutorial.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,9 @@
354354
},
355355
"outputs": [],
356356
"source": [
357-
"def backward(ctx, grad_output):\n",
357+
"def backward(ctx, grad):\n",
358358
" x, = ctx.saved_tensors\n",
359-
" return grad_input * x.cos()\n",
359+
" return grad * x.cos()\n",
360360
"\n",
361361
"def setup_context(ctx, inputs, output):\n",
362362
" x, = inputs\n",
@@ -404,9 +404,9 @@
404404
" wrap_triton(cos_kernel)[(n_elements,)](x, out, n_elements, BLOCK_SIZE=4)\n",
405405
" return out\n",
406406
"\n",
407-
"def backward(ctx, grad_output):\n",
407+
"def backward(ctx, grad):\n",
408408
" x, = ctx.saved_tensors\n",
409-
" return grad_input * mycos(x)\n",
409+
" return grad * mycos(x)\n",
410410
"\n",
411411
"def setup_context(ctx, inputs, output):\n",
412412
" x, = inputs\n",
-173 Bytes
Loading
309 Bytes
Loading

_images/sphx_glr_coding_ddpg_001.png

406 Bytes
Loading
4.46 KB
Loading
-268 Bytes
Loading
235 Bytes
Loading
-91 Bytes
Loading
1.05 KB
Loading

0 commit comments

Comments
 (0)