File: minifier_smoke.py

package info (click to toggle)
pytorch-cuda 2.6.0%2Bdfsg-7
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid, trixie
  • size: 161,620 kB
  • sloc: python: 1,278,832; cpp: 900,322; ansic: 82,710; asm: 7,754; java: 3,363; sh: 2,811; javascript: 2,443; makefile: 597; ruby: 195; xml: 84; objc: 68
file content (33 lines) | stat: -rw-r--r-- 763 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Owner(s): ["module: inductor"]
#
# This smoketest is referenced in the internal-only minifier runbook
# https://docs.google.com/document/d/18L9e7bZSBpJ7gGbwlUV13LasmjiEX2lree2pl-SdbCU/edit
import os


os.environ["TORCHDYNAMO_REPRO_AFTER"] = "dynamo"
import torch
import torch._dynamo as torchdynamo
import torch._inductor.config
import torch._ops


torch._inductor.config.cpp.inject_relu_bug_TESTING_ONLY = "compile_error"


def func(x):
    x = torch.sigmoid(x)
    x = torch.mul(x, torch.ones(2))
    x = torch.relu(x)
    x = torch.add(x, torch.zeros(2))
    x = torch.ops.aten.round(x)
    return x


def run_internal_minifier():
    torchdynamo.config.debug_dir_root = "."
    f_opt = torch.compile(func)
    f_opt(torch.ones(2))


run_internal_minifier()