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
import torch.nn.parallel
import torch.utils.data
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_convolution_relu_0(in_out_ptr0, in_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x3 = xindex
    x1 = xindex // 64 % 64
    tmp0 = tl.load(in_out_ptr0 + x3, None)
    tmp1 = tl.load(in_ptr0 + x1, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = tl.full([1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tl.store(in_out_ptr0 + x3, tmp4, None)


@triton.jit
def triton_poi_fused_cat_1(in_ptr0, in_ptr1, in_ptr2, in_ptr3, out_ptr0,
    xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x1 = xindex // 64 % 256
    x0 = xindex % 64
    x2 = xindex // 16384
    x3 = xindex
    tmp0 = x1
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 128, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + (x0 + 64 * x1 + 8192 * x2), tmp4, other=0.0)
    tmp6 = tl.load(in_ptr1 + x1, tmp4, eviction_policy='evict_last', other=0.0)
    tmp7 = tmp5 + tmp6
    tmp8 = tl.full([1], 0, tl.int32)
    tmp9 = triton_helpers.maximum(tmp8, tmp7)
    tmp10 = tl.full(tmp9.shape, 0.0, tmp9.dtype)
    tmp11 = tl.where(tmp4, tmp9, tmp10)
    tmp12 = tmp0 >= tmp3
    tl.full([1], 256, tl.int64)
    tmp15 = tl.load(in_ptr2 + (x0 + 64 * (-128 + x1) + 8192 * x2), tmp12,
        other=0.0)
    tmp16 = tl.load(in_ptr3 + (-128 + x1), tmp12, eviction_policy=
        'evict_last', other=0.0)
    tmp17 = tmp15 + tmp16
    tmp18 = triton_helpers.maximum(tmp8, tmp17)
    tmp19 = tl.full(tmp18.shape, 0.0, tmp18.dtype)
    tmp20 = tl.where(tmp12, tmp18, tmp19)
    tmp21 = tl.where(tmp4, tmp11, tmp20)
    tl.store(out_ptr0 + x3, tmp21, None)


@triton.jit
def triton_poi_fused_cat_2(in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4,
    out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x1 = xindex // 64 % 640
    x0 = xindex % 64
    x2 = xindex // 40960
    x3 = xindex
    tmp0 = x1
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 128, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.full([1], 64, tl.int64)
    tmp6 = tmp0 < tmp5
    tmp7 = tmp6 & tmp4
    tmp8 = tl.load(in_ptr0 + (x0 + 64 * x1 + 4096 * x2), tmp7, other=0.0)
    tmp9 = tmp0 >= tmp5
    tmp10 = tmp9 & tmp4
    tmp11 = tl.load(in_ptr1 + (x0 + 64 * (-64 + x1) + 4096 * x2), tmp10,
        other=0.0)
    tmp12 = tl.where(tmp6, tmp8, tmp11)
    tmp13 = tl.full(tmp12.shape, 0.0, tmp12.dtype)
    tmp14 = tl.where(tmp4, tmp12, tmp13)
    tmp15 = tmp0 >= tmp3
    tmp16 = tl.full([1], 384, tl.int64)
    tmp17 = tmp0 < tmp16
    tmp18 = tmp15 & tmp17
    tmp19 = tl.load(in_ptr2 + (x0 + 64 * (-128 + x1) + 16384 * x2), tmp18,
        other=0.0)
    tmp20 = tmp0 >= tmp16
    tl.full([1], 640, tl.int64)
    tmp23 = tl.load(in_ptr3 + (x0 + 64 * (-384 + x1) + 16384 * x2), tmp20,
        other=0.0)
    tmp24 = tl.load(in_ptr4 + (-384 + x1), tmp20, eviction_policy=
        'evict_last', other=0.0)
    tmp25 = tmp23 + tmp24
    tmp26 = tl.full([1], 0, tl.int32)
    tmp27 = triton_helpers.maximum(tmp26, tmp25)
    tmp28 = tl.full(tmp27.shape, 0.0, tmp27.dtype)
    tmp29 = tl.where(tmp20, tmp27, tmp28)
    tmp30 = tl.where(tmp18, tmp19, tmp29)
    tmp31 = tl.where(tmp4, tmp14, tmp30)
    tl.store(out_ptr0 + x3, tmp31, None)


@triton.jit
def triton_poi_fused_convolution_leaky_relu_3(in_ptr0, in_ptr1, out_ptr0,
    out_ptr1, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x3 = xindex
    x1 = xindex // 64 % 320
    tmp0 = tl.load(in_ptr0 + x3, None)
    tmp1 = tl.load(in_ptr1 + x1, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = tmp2 > tmp3
    tmp5 = 0.01
    tmp6 = tmp2 * tmp5
    tmp7 = tl.where(tmp4, tmp2, tmp6)
    tl.store(out_ptr0 + x3, tmp4, None)
    tl.store(out_ptr1 + x3, tmp7, None)


@triton.jit
def triton_poi_fused_convolution_4(in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl
    .constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x3 = xindex
    x1 = xindex // 64 % 160
    tmp0 = tl.load(in_out_ptr0 + x3, None)
    tmp1 = tl.load(in_ptr0 + x1, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tl.store(in_out_ptr0 + x3, tmp2, None)


@triton.jit
def triton_poi_fused_convolution_relu_threshold_backward_5(in_ptr0, in_ptr1,
    out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x3 = xindex
    x1 = xindex // 64 % 256
    tmp0 = tl.load(in_ptr0 + x3, None)
    tmp1 = tl.load(in_ptr1 + x1, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = tl.full([1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tmp5 = 0.0
    tmp6 = tmp4 <= tmp5
    tl.store(out_ptr0 + x3, tmp6, None)


@triton.jit
def triton_poi_fused_convolution_relu_threshold_backward_6(in_ptr0, in_ptr1,
    out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    tl.full([XBLOCK], True, tl.int1)
    x3 = xindex
    x1 = xindex // 64 % 128
    tmp0 = tl.load(in_ptr0 + x3, None)
    tmp1 = tl.load(in_ptr1 + x1, None, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = tl.full([1], 0, tl.int32)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tmp5 = 0.0
    tmp6 = tmp4 <= tmp5
    tl.store(out_ptr0 + x3, tmp6, 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) = args
    args.clear()
    assert_size_stride(primals_1, (64, 3, 1), (3, 1, 1))
    assert_size_stride(primals_2, (64,), (1,))
    assert_size_stride(primals_3, (4, 3, 64), (192, 64, 1))
    assert_size_stride(primals_4, (64, 32, 1), (32, 1, 1))
    assert_size_stride(primals_5, (64,), (1,))
    assert_size_stride(primals_6, (4, 32, 64), (2048, 64, 1))
    assert_size_stride(primals_7, (128, 64, 1), (64, 1, 1))
    assert_size_stride(primals_8, (128,), (1,))
    assert_size_stride(primals_9, (128, 64, 1), (64, 1, 1))
    assert_size_stride(primals_10, (128,), (1,))
    assert_size_stride(primals_11, (256, 256, 1), (256, 1, 1))
    assert_size_stride(primals_12, (256,), (1,))
    assert_size_stride(primals_13, (320, 640, 1), (640, 1, 1))
    assert_size_stride(primals_14, (320,), (1,))
    assert_size_stride(primals_15, (160, 320, 1), (320, 1, 1))
    assert_size_stride(primals_16, (160,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = extern_kernels.convolution(primals_3, primals_1, stride=(1,),
            padding=(0,), dilation=(1,), transposed=False, output_padding=(
            0,), groups=1, bias=None)
        assert_size_stride(buf0, (4, 64, 64), (4096, 64, 1))
        buf1 = buf0
        del buf0
        get_raw_stream(0)
        triton_poi_fused_convolution_relu_0[grid(16384)](buf1, primals_2, 
            16384, XBLOCK=128, num_warps=4, num_stages=1)
        del primals_2
        buf2 = extern_kernels.convolution(primals_6, primals_4, stride=(1,),
            padding=(0,), dilation=(1,), transposed=False, output_padding=(
            0,), groups=1, bias=None)
        assert_size_stride(buf2, (4, 64, 64), (4096, 64, 1))
        buf3 = buf2
        del buf2
        triton_poi_fused_convolution_relu_0[grid(16384)](buf3, primals_5, 
            16384, XBLOCK=128, num_warps=4, num_stages=1)
        del primals_5
        buf4 = extern_kernels.convolution(buf1, primals_7, stride=(1,),
            padding=(0,), dilation=(1,), transposed=False, output_padding=(
            0,), groups=1, bias=None)
        assert_size_stride(buf4, (4, 128, 64), (8192, 64, 1))
        buf5 = extern_kernels.convolution(buf3, primals_9, stride=(1,),
            padding=(0,), dilation=(1,), transposed=False, output_padding=(
            0,), groups=1, bias=None)
        assert_size_stride(buf5, (4, 128, 64), (8192, 64, 1))
        buf6 = empty_strided_cuda((4, 256, 64), (16384, 64, 1), torch.float32)
        triton_poi_fused_cat_1[grid(65536)](buf4, primals_8, buf5,
            primals_10, buf6, 65536, XBLOCK=512, num_warps=4, num_stages=1)
        buf7 = extern_kernels.convolution(buf6, primals_11, stride=(1,),
            padding=(0,), dilation=(1,), transposed=False, output_padding=(
            0,), groups=1, bias=None)
        assert_size_stride(buf7, (4, 256, 64), (16384, 64, 1))
        buf8 = empty_strided_cuda((4, 640, 64), (40960, 64, 1), torch.float32)
        triton_poi_fused_cat_2[grid(163840)](buf1, buf3, buf6, buf7,
            primals_12, buf8, 163840, XBLOCK=512, num_warps=8, num_stages=1)
        buf9 = extern_kernels.convolution(buf8, primals_13, stride=(1,),
            padding=(0,), dilation=(1,), transposed=False, output_padding=(
            0,), groups=1, bias=None)
        assert_size_stride(buf9, (4, 320, 64), (20480, 64, 1))
        buf10 = empty_strided_cuda((4, 320, 64), (20480, 64, 1), torch.bool)
        buf11 = empty_strided_cuda((4, 320, 64), (20480, 64, 1), torch.float32)
        triton_poi_fused_convolution_leaky_relu_3[grid(81920)](buf9,
            primals_14, buf10, buf11, 81920, XBLOCK=1024, num_warps=4,
            num_stages=1)
        del buf9
        del primals_14
        buf12 = extern_kernels.convolution(buf11, primals_15, stride=(1,),
            padding=(0,), dilation=(1,), transposed=False, output_padding=(
            0,), groups=1, bias=None)
        assert_size_stride(buf12, (4, 160, 64), (10240, 64, 1))
        buf13 = buf12
        del buf12
        triton_poi_fused_convolution_4[grid(40960)](buf13, primals_16, 
            40960, XBLOCK=512, num_warps=4, num_stages=1)
        del primals_16
        buf14 = empty_strided_cuda((4, 256, 64), (16384, 64, 1), torch.bool)
        triton_poi_fused_convolution_relu_threshold_backward_5[grid(65536)](
            buf7, primals_12, buf14, 65536, XBLOCK=512, num_warps=4,
            num_stages=1)
        del buf7
        del primals_12
        buf15 = empty_strided_cuda((4, 128, 64), (8192, 64, 1), torch.bool)
        triton_poi_fused_convolution_relu_threshold_backward_6[grid(32768)](
            buf5, primals_10, buf15, 32768, XBLOCK=256, num_warps=4,
            num_stages=1)
        del buf5
        del primals_10
        buf16 = empty_strided_cuda((4, 128, 64), (8192, 64, 1), torch.bool)
        triton_poi_fused_convolution_relu_threshold_backward_6[grid(32768)](
            buf4, primals_8, buf16, 32768, XBLOCK=256, num_warps=4,
            num_stages=1)
        del buf4
        del primals_8
    return (buf13, primals_1, primals_3, primals_4, primals_6, primals_7,
        primals_9, primals_11, primals_13, primals_15, buf1, buf3, buf6,
        buf8, buf10, buf11, buf14, buf15, buf16)


class PoseNetFeatNew(nn.Module):

    def __init__(self, num_points):
        super(PoseNetFeatNew, self).__init__()
        self.conv1 = torch.nn.Conv1d(3, 64, 1)
        self.conv2 = torch.nn.Conv1d(64, 128, 1)
        self.e_conv1 = torch.nn.Conv1d(32, 64, 1)
        self.e_conv2 = torch.nn.Conv1d(64, 128, 1)
        self.conv5 = torch.nn.Conv1d(256, 256, 1)
        self.all_conv1 = torch.nn.Conv1d(640, 320, 1)
        self.all_conv2 = torch.nn.Conv1d(320, 160, 1)
        self.num_points = num_points

    def forward(self, input_0, input_1):
        primals_1 = self.conv1.weight
        primals_2 = self.conv1.bias
        primals_7 = self.conv2.weight
        primals_8 = self.conv2.bias
        primals_4 = self.e_conv1.weight
        primals_5 = self.e_conv1.bias
        primals_9 = self.e_conv2.weight
        primals_10 = self.e_conv2.bias
        primals_11 = self.conv5.weight
        primals_12 = self.conv5.bias
        primals_13 = self.all_conv1.weight
        primals_14 = self.all_conv1.bias
        primals_15 = self.all_conv2.weight
        primals_16 = self.all_conv2.bias
        primals_3 = input_0
        primals_6 = input_1
        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])
        return output[0]


Measured latency_ms: 0.041587