Benign repos Download

test_autograd_function.py

Python comment contains a URLReferences a public code-forge URL
SHA-2560820a2a4f70f5e9df317855a1cab37621af07f10dc1f2ff0cedcddf4ac128aa0

Evidence

imports copy lines 1–28
1:5… ner(s): ["module: dynamo"]
2# flake8: noqa: B950
3import copy
4import math
5from dataclasses import dataclass
6
7import torch
8import torch._dynamo.test_case
9import torch._dynamo.testing
10import torch._dynamo.utils
11from torch._dynamo.testing import AotEagerAndRecordGraphs
12from torch.testing._internal.triton_utils import HAS_GPU, requires_gpu
13
14
15device_type = (
16 acc.type if (acc := torch.accelerator.current_accelerator(True)) else "cpu"
17)
18
19if HAS_GPU:
20 import triton
21
22 from torch.testing._internal.triton_utils import add_kernel
23
24
⋯4 lines
Python repeats repository clone calls lines 131–140
131:18… tx, x):
132 ctx.set_materialize_grads(False)
133 return x.clone(), x.clone()
134
135 @staticmethod
⋯5 lines
Python test source content lines 230–237
230:46… t_case.TestCase):
231 # Sound behaviors, tested for working capture
232 def test_autograd_function_equivalence(self):
233 for grad in [True, False]:
234 for i in range(1, 5):
235 torch._dynamo.reset()
236 model = globals()[f"Module{i}"]()
237 …
imports once_differentiable from torch.autograd.function lines 364–368
364:6… ef test_once_differentiable(self):
365 from torch.autograd.function import once_differentiable
366
367 torch._dynamo.utils.counters.clear()
368 cnt = torch._dynamo.testing.CompileCounte …
References a public code-forge URL lines 1450–1456
1450:8… x2 = x1.clone()
1451 self.assertEqual(f(x1), Foo.apply(x2))
1452
1453 # https://github.com/pytorch/pytorch/issues/129963
1454 def test_fwd_propogation_correctness(self):
1455 class MyCube(torch.autograd.Function):
1456 …

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.