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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda


@triton.jit
def triton_poi_fused_clone_0(in_ptr0, out_ptr0, ynumel, xnumel, YBLOCK: tl.
    constexpr, XBLOCK: tl.constexpr):
    ynumel = 16
    xnumel = 4
    yoffset = tl.program_id(1) * YBLOCK
    yindex = yoffset + tl.arange(0, YBLOCK)[None, :]
    ymask = yindex < ynumel
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    x2 = xindex
    y0 = yindex % 4
    y1 = yindex // 4
    y3 = yindex
    tmp0 = tl.load(in_ptr0 + (y0 + 4 * x2 + 16 * y1), xmask & ymask,
        eviction_policy='evict_last')
    tl.store(out_ptr0 + (x2 + 4 * y3), tmp0, xmask & ymask)


@triton.jit
def triton_poi_fused_add_clone_relu_1(in_ptr0, in_ptr1, in_ptr2, in_ptr3,
    in_ptr4, in_ptr5, out_ptr0, ynumel, xnumel, YBLOCK: tl.constexpr,
    XBLOCK: tl.constexpr):
    ynumel = 8
    xnumel = 4
    yoffset = tl.program_id(1) * YBLOCK
    yindex = yoffset + tl.arange(0, YBLOCK)[None, :]
    ymask = yindex < ynumel
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    x2 = xindex
    y3 = yindex
    y0 = yindex % 2
    y1 = yindex // 2
    tmp0 = tl.load(in_ptr0 + (x2 + 4 * y3), xmask & ymask, eviction_policy=
        'evict_last')
    tmp1 = tl.load(in_ptr1 + y0, ymask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr2 + (x2 + 4 * y3), xmask & ymask, eviction_policy=
        'evict_last')
    tmp6 = tl.load(in_ptr3 + y0, ymask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr4 + (x2 + 4 * y3), xmask & ymask, eviction_policy
        ='evict_last')
    tmp11 = tl.load(in_ptr5 + y0, ymask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = tl.full([1, 1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tmp7 = tmp5 + tmp6
    tmp8 = triton_helpers.maximum(tmp3, tmp7)
    tmp9 = tmp4 + tmp8
    tmp12 = tmp10 + tmp11
    tmp13 = triton_helpers.maximum(tmp3, tmp12)
    tmp14 = tmp9 + tmp13
    tl.store(out_ptr0 + (y0 + 2 * x2 + 8 * y1), tmp14, xmask & ymask)


@triton.jit
def triton_poi_fused_clone_relu_threshold_backward_2(in_ptr0, in_ptr1,
    out_ptr0, ynumel, xnumel, YBLOCK: tl.constexpr, XBLOCK: tl.constexpr):
    ynumel = 16
    xnumel = 2
    yoffset = tl.program_id(1) * YBLOCK
    yindex = yoffset + tl.arange(0, YBLOCK)[None, :]
    ymask = yindex < ynumel
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    x2 = xindex
    y0 = yindex % 4
    y1 = yindex // 4
    y3 = yindex
    tmp0 = tl.load(in_ptr0 + (y0 + 4 * x2 + 8 * y1), xmask & ymask,
        eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + x2, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = tl.full([1, 1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tmp5 = 0.0
    tmp6 = tmp4 <= tmp5
    tl.store(out_ptr0 + (x2 + 2 * y3), tmp6, xmask & ymask)


def call(args):
    (primals_1, primals_2, primals_3, primals_4, primals_5, primals_6,
        primals_7) = args
    args.clear()
    assert_size_stride(primals_1, (4, 4, 4), (16, 4, 1))
    assert_size_stride(primals_2, (2, 4, 1), (4, 1, 1))
    assert_size_stride(primals_3, (2,), (1,))
    assert_size_stride(primals_4, (2, 4, 3), (12, 3, 1))
    assert_size_stride(primals_5, (2,), (1,))
    assert_size_stride(primals_6, (2, 4, 5), (20, 5, 1))
    assert_size_stride(primals_7, (2,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_clone_0[grid(16, 4)](primals_1, buf0, 16, 4,
            XBLOCK=4, YBLOCK=16, num_warps=1, num_stages=1)
        del primals_1
        buf1 = extern_kernels.convolution(buf0, primals_2, stride=(1,),
            padding=(0,), dilation=(1,), transposed=False, output_padding=(
            0,), groups=1, bias=None)
        assert_size_stride(buf1, (4, 2, 4), (8, 4, 1))
        buf2 = extern_kernels.convolution(buf0, primals_4, stride=(1,),
            padding=(1,), dilation=(1,), transposed=False, output_padding=(
            0,), groups=1, bias=None)
        assert_size_stride(buf2, (4, 2, 4), (8, 4, 1))
        buf3 = extern_kernels.convolution(buf0, primals_6, stride=(1,),
            padding=(2,), dilation=(1,), transposed=False, output_padding=(
            0,), groups=1, bias=None)
        assert_size_stride(buf3, (4, 2, 4), (8, 4, 1))
        buf4 = empty_strided_cuda((4, 4, 2), (8, 2, 1), torch.float32)
        triton_poi_fused_add_clone_relu_1[grid(8, 4)](buf1, primals_3, buf2,
            primals_5, buf3, primals_7, buf4, 8, 4, XBLOCK=4, YBLOCK=8,
            num_warps=1, num_stages=1)
        buf5 = empty_strided_cuda((4, 4, 2), (8, 2, 1), torch.bool)
        triton_poi_fused_clone_relu_threshold_backward_2[grid(16, 2)](buf3,
            primals_7, buf5, 16, 2, XBLOCK=2, YBLOCK=16, num_warps=1,
            num_stages=1)
        del buf3
        del primals_7
        buf6 = empty_strided_cuda((4, 4, 2), (8, 2, 1), torch.bool)
        triton_poi_fused_clone_relu_threshold_backward_2[grid(16, 2)](buf2,
            primals_5, buf6, 16, 2, XBLOCK=2, YBLOCK=16, num_warps=1,
            num_stages=1)
        del buf2
        del primals_5
        buf7 = empty_strided_cuda((4, 4, 2), (8, 2, 1), torch.bool)
        triton_poi_fused_clone_relu_threshold_backward_2[grid(16, 2)](buf1,
            primals_3, buf7, 16, 2, XBLOCK=2, YBLOCK=16, num_warps=1,
            num_stages=1)
        del buf1
        del primals_3
    return buf4, primals_2, primals_4, primals_6, buf0, buf5, buf6, buf7


class CnnQAHeadNew(nn.Module):

    def __init__(self, input_size):
        super().__init__()
        self.conv_1 = nn.Conv1d(in_channels=input_size, out_channels=2,
            kernel_size=1, padding=0)
        self.conv_3 = nn.Conv1d(in_channels=input_size, out_channels=2,
            kernel_size=3, padding=1)
        self.conv_5 = nn.Conv1d(in_channels=input_size, out_channels=2,
            kernel_size=5, padding=2)
        self.relu = nn.ReLU()

    def forward(self, input_0):
        primals_2 = self.conv_1.weight
        primals_3 = self.conv_1.bias
        primals_4 = self.conv_3.weight
        primals_5 = self.conv_3.bias
        primals_6 = self.conv_5.weight
        primals_7 = self.conv_5.bias
        primals_1 = input_0
        output = call([primals_1, primals_2, primals_3, primals_4,
            primals_5, primals_6, primals_7])
        return output[0]


Measured latency_ms: 0.122046