import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride


@triton.jit
def triton_poi_fused_relu_0(in_out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x0 = xindex
    tmp0 = tl.load(in_out_ptr0 + x0, None)
    tmp1 = tl.full([1], 0, tl.int32)
    tmp2 = triton_helpers.maximum(tmp1, tmp0)
    tl.store(in_out_ptr0 + x0, tmp2, None)


def call(args):
    (primals_1, primals_2, primals_3, primals_4, primals_5, primals_6,
        primals_7, primals_8, primals_9, primals_10, primals_11, primals_12,
        primals_13, primals_14, primals_15, primals_16, primals_17,
        primals_18, primals_19, primals_20, primals_21) = args
    args.clear()
    assert_size_stride(primals_1, (8, 1, 3, 3), (9, 9, 3, 1))
    assert_size_stride(primals_2, (4, 1, 64, 64), (4096, 4096, 64, 1))
    assert_size_stride(primals_3, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_4, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_5, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_6, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_7, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_8, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_9, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_10, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_11, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_12, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_13, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_14, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_15, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_16, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_17, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_18, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_19, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_20, (8, 8, 3, 3), (72, 9, 3, 1))
    assert_size_stride(primals_21, (1, 8, 3, 3), (72, 9, 3, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = extern_kernels.convolution(primals_2, primals_1, stride=(1, 
            1), padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf0, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf1 = buf0
        del buf0
        get_raw_stream(0)
        triton_poi_fused_relu_0[grid(131072)](buf1, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf2 = extern_kernels.convolution(buf1, primals_3, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf2, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf3 = buf2
        del buf2
        triton_poi_fused_relu_0[grid(131072)](buf3, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf4 = extern_kernels.convolution(buf3, primals_4, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf4, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf5 = buf4
        del buf4
        triton_poi_fused_relu_0[grid(131072)](buf5, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf6 = extern_kernels.convolution(buf5, primals_5, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf6, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf7 = buf6
        del buf6
        triton_poi_fused_relu_0[grid(131072)](buf7, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf8 = extern_kernels.convolution(buf7, primals_6, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf8, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf9 = buf8
        del buf8
        triton_poi_fused_relu_0[grid(131072)](buf9, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf10 = extern_kernels.convolution(buf9, primals_7, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf10, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf11 = buf10
        del buf10
        triton_poi_fused_relu_0[grid(131072)](buf11, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf12 = extern_kernels.convolution(buf11, primals_8, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf12, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf13 = buf12
        del buf12
        triton_poi_fused_relu_0[grid(131072)](buf13, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf14 = extern_kernels.convolution(buf13, primals_9, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf14, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf15 = buf14
        del buf14
        triton_poi_fused_relu_0[grid(131072)](buf15, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf16 = extern_kernels.convolution(buf15, primals_10, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf16, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf17 = buf16
        del buf16
        triton_poi_fused_relu_0[grid(131072)](buf17, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf18 = extern_kernels.convolution(buf17, primals_11, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf18, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf19 = buf18
        del buf18
        triton_poi_fused_relu_0[grid(131072)](buf19, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf20 = extern_kernels.convolution(buf19, primals_12, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf20, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf21 = buf20
        del buf20
        triton_poi_fused_relu_0[grid(131072)](buf21, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf22 = extern_kernels.convolution(buf21, primals_13, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf22, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf23 = buf22
        del buf22
        triton_poi_fused_relu_0[grid(131072)](buf23, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf24 = extern_kernels.convolution(buf23, primals_14, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf24, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf25 = buf24
        del buf24
        triton_poi_fused_relu_0[grid(131072)](buf25, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf26 = extern_kernels.convolution(buf25, primals_15, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf26, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf27 = buf26
        del buf26
        triton_poi_fused_relu_0[grid(131072)](buf27, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf28 = extern_kernels.convolution(buf27, primals_16, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf28, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf29 = buf28
        del buf28
        triton_poi_fused_relu_0[grid(131072)](buf29, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf30 = extern_kernels.convolution(buf29, primals_17, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf30, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf31 = buf30
        del buf30
        triton_poi_fused_relu_0[grid(131072)](buf31, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf32 = extern_kernels.convolution(buf31, primals_18, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf32, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf33 = buf32
        del buf32
        triton_poi_fused_relu_0[grid(131072)](buf33, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf34 = extern_kernels.convolution(buf33, primals_19, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf34, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf35 = buf34
        del buf34
        triton_poi_fused_relu_0[grid(131072)](buf35, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf36 = extern_kernels.convolution(buf35, primals_20, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf36, (4, 8, 64, 64), (32768, 4096, 64, 1))
        buf37 = buf36
        del buf36
        triton_poi_fused_relu_0[grid(131072)](buf37, 131072, XBLOCK=512,
            num_warps=8, num_stages=1)
        buf38 = extern_kernels.convolution(buf37, primals_21, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf38, (4, 1, 64, 64), (4096, 4096, 64, 1))
    return (buf38, primals_1, primals_2, primals_3, primals_4, primals_5,
        primals_6, primals_7, primals_8, primals_9, primals_10, primals_11,
        primals_12, primals_13, primals_14, primals_15, primals_16,
        primals_17, primals_18, primals_19, primals_20, primals_21, buf1,
        buf3, buf5, buf7, buf9, buf11, buf13, buf15, buf17, buf19, buf21,
        buf23, buf25, buf27, buf29, buf31, buf33, buf35, buf37)


def load_param(model1_path, model2):
    dict_param1 = torch.load(model1_path)
    dict_param2 = dict(model2.named_parameters())
    for name2 in dict_param2:
        if name2 in dict_param1:
            dict_param2[name2].data.copy_(dict_param1[name2].data)
    model2.load_state_dict(dict_param2)
    return model2


class SmallVDSR_F8New(nn.Module):

    def __init__(self, model=False, fixed=False):
        super(SmallVDSR_F8New, self).__init__()
        self.fixed = fixed
        self.conv1 = nn.Conv2d(1, 8, 3, 1, 1, bias=False)
        self.conv2 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv3 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv4 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv5 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv6 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv7 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv8 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv9 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv10 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv11 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv12 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv13 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv14 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv15 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv16 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv17 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv18 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv19 = nn.Conv2d(8, 8, 3, 1, 1, bias=False)
        self.conv20 = nn.Conv2d(8, 1, 3, 1, 1, bias=False)
        self.relu = nn.ReLU()
        if model:
            load_param(model, self)
        if fixed:
            for param in self.parameters():
                param.requires_grad = False

    def forward_stem(self, y):
        y = self.relu(self.conv1(y))
        out1 = y
        y = self.relu(self.conv2(y))
        out2 = y
        y = self.relu(self.conv3(y))
        out3 = y
        y = self.relu(self.conv4(y))
        out4 = y
        y = self.relu(self.conv5(y))
        out5 = y
        y = self.relu(self.conv6(y))
        out6 = y
        y = self.relu(self.conv7(y))
        out7 = y
        y = self.relu(self.conv8(y))
        out8 = y
        y = self.relu(self.conv9(y))
        out9 = y
        y = self.relu(self.conv10(y))
        out10 = y
        y = self.relu(self.conv11(y))
        out11 = y
        y = self.relu(self.conv12(y))
        out12 = y
        y = self.relu(self.conv13(y))
        out13 = y
        y = self.relu(self.conv14(y))
        out14 = y
        y = self.relu(self.conv15(y))
        out15 = y
        y = self.relu(self.conv16(y))
        out16 = y
        y = self.relu(self.conv17(y))
        out17 = y
        y = self.relu(self.conv18(y))
        out18 = y
        y = self.relu(self.conv19(y))
        out19 = y
        y = self.conv20(y)
        return (out1, out2, out3, out4, out5, out6, out7, out8, out9, out10,
            out11, out12, out13, out14, out15, out16, out17, out18, out19, y)

    def forward_dense(self, y):
        y = self.relu(self.conv1(y))
        out1 = y
        y = self.relu(self.conv2(y))
        out2 = y
        y = self.relu(self.conv3(y))
        out3 = y
        y = self.relu(self.conv4(y))
        out4 = y
        y = self.relu(self.conv5(y))
        out5 = y
        y = self.relu(self.conv6(y))
        out6 = y
        y = self.relu(self.conv7(y))
        out7 = y
        y = self.relu(self.conv8(y))
        out8 = y
        y = self.relu(self.conv9(y))
        out9 = y
        y = self.relu(self.conv10(y))
        out10 = y
        y = self.relu(self.conv11(y))
        out11 = y
        y = self.relu(self.conv12(y))
        out12 = y
        y = self.relu(self.conv13(y))
        out13 = y
        y = self.relu(self.conv14(y))
        out14 = y
        y = self.relu(self.conv15(y))
        out15 = y
        y = self.relu(self.conv16(y))
        out16 = y
        y = self.relu(self.conv17(y))
        out17 = y
        y = self.relu(self.conv18(y))
        out18 = y
        y = self.relu(self.conv19(y))
        out19 = y
        y = self.conv20(y)
        out20 = y
        return (out1, out2, out3, out4, out5, out6, out7, out8, out9, out10,
            out11, out12, out13, out14, out15, out16, out17, out18, out19,
            out20)

    def forward(self, input_0):
        primals_1 = self.conv1.weight
        primals_3 = self.conv2.weight
        primals_4 = self.conv3.weight
        primals_5 = self.conv4.weight
        primals_6 = self.conv5.weight
        primals_7 = self.conv6.weight
        primals_8 = self.conv7.weight
        primals_9 = self.conv8.weight
        primals_10 = self.conv9.weight
        primals_11 = self.conv10.weight
        primals_12 = self.conv11.weight
        primals_13 = self.conv12.weight
        primals_14 = self.conv13.weight
        primals_15 = self.conv14.weight
        primals_16 = self.conv15.weight
        primals_17 = self.conv16.weight
        primals_18 = self.conv17.weight
        primals_19 = self.conv18.weight
        primals_20 = self.conv19.weight
        primals_21 = self.conv20.weight
        primals_2 = input_0
        output = call([primals_1, primals_2, primals_3, primals_4,
            primals_5, primals_6, primals_7, primals_8, primals_9,
            primals_10, primals_11, primals_12, primals_13, primals_14,
            primals_15, primals_16, primals_17, primals_18, primals_19,
            primals_20, primals_21])
        return output[0]


Measured latency_ms: 0.409518