File: fixtures_src.py

package info (click to toggle)
pytorch 1.13.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 139,252 kB
  • sloc: cpp: 1,100,274; python: 706,454; ansic: 83,052; asm: 7,618; java: 3,273; sh: 2,841; javascript: 612; makefile: 323; xml: 269; ruby: 185; yacc: 144; objc: 68; lex: 44
file content (59 lines) | stat: -rw-r--r-- 1,899 bytes parent folder | download
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import torch
from typing import Union

class TestVersionedDivTensorExampleV7(torch.nn.Module):
    def __init__(self):
        super(TestVersionedDivTensorExampleV7, self).__init__()

    def forward(self, a, b):
        result_0 = a / b
        result_1 = torch.div(a, b)
        result_2 = a.div(b)
        return result_0, result_1, result_2

class TestVersionedLinspaceV7(torch.nn.Module):
    def __init__(self):
        super(TestVersionedLinspaceV7, self).__init__()

    def forward(self, a: Union[int, float, complex], b: Union[int, float, complex]):
        c = torch.linspace(a, b, steps=5)
        d = torch.linspace(a, b)
        return c, d

class TestVersionedLinspaceOutV7(torch.nn.Module):
    def __init__(self):
        super(TestVersionedLinspaceOutV7, self).__init__()

    def forward(self, a: Union[int, float, complex], b: Union[int, float, complex], out: torch.Tensor):
        return torch.linspace(a, b, out=out)

class TestVersionedLogspaceV8(torch.nn.Module):
    def __init__(self):
        super(TestVersionedLogspaceV8, self).__init__()

    def forward(self, a: Union[int, float, complex], b: Union[int, float, complex]):
        c = torch.logspace(a, b, steps=5)
        d = torch.logspace(a, b)
        return c, d

class TestVersionedLogspaceOutV8(torch.nn.Module):
    def __init__(self):
        super(TestVersionedLogspaceOutV8, self).__init__()

    def forward(self, a: Union[int, float, complex], b: Union[int, float, complex], out: torch.Tensor):
        return torch.logspace(a, b, out=out)

class TestVersionedGeluV9(torch.nn.Module):
    def __init__(self):
        super().__init__()

    def forward(self, x):
        return torch._C._nn.gelu(x)

class TestVersionedGeluOutV9(torch.nn.Module):
    def __init__(self):
        super().__init__()

    def forward(self, x):
        out = torch.zeros_like(x)
        return torch._C._nn.gelu(x, out=out)