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
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor


@triton.jit
def triton_poi_fused_leaky_relu_0(in_out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_out_ptr0 + x0, xmask)
    tmp1 = 0.0
    tmp2 = tmp0 > tmp1
    tmp3 = 0.01
    tmp4 = tmp0 * tmp3
    tmp5 = tl.where(tmp2, tmp0, tmp4)
    tl.store(in_out_ptr0 + x0, tmp5, xmask)


@triton.jit
def triton_poi_fused_convolution_relu_1(in_out_ptr0, in_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 1024
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 16
    tmp0 = tl.load(in_out_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr0 + x1, xmask, 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 + x2, tmp4, xmask)


@triton.jit
def triton_poi_fused_max_pool2d_with_indices_2(in_ptr0, out_ptr0, out_ptr1,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 2
    x1 = xindex // 2
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + (2 * x0 + 8 * x1), xmask, eviction_policy=
        'evict_last')
    tmp1 = tl.load(in_ptr0 + (1 + 2 * x0 + 8 * x1), xmask, eviction_policy=
        'evict_last')
    tmp3 = tl.load(in_ptr0 + (4 + 2 * x0 + 8 * x1), xmask, eviction_policy=
        'evict_last')
    tmp5 = tl.load(in_ptr0 + (5 + 2 * x0 + 8 * x1), xmask, eviction_policy=
        'evict_last')
    tmp2 = triton_helpers.maximum(tmp1, tmp0)
    tmp4 = triton_helpers.maximum(tmp3, tmp2)
    tmp6 = triton_helpers.maximum(tmp5, tmp4)
    tmp7 = tmp1 > tmp0
    tmp8 = tl.full([1], 1, tl.int8)
    tmp9 = tl.full([1], 0, tl.int8)
    tmp10 = tl.where(tmp7, tmp8, tmp9)
    tmp11 = tmp3 > tmp2
    tmp12 = tl.full([1], 2, tl.int8)
    tmp13 = tl.where(tmp11, tmp12, tmp10)
    tmp14 = tmp5 > tmp4
    tmp15 = tl.full([1], 3, tl.int8)
    tmp16 = tl.where(tmp14, tmp15, tmp13)
    tl.store(out_ptr0 + x2, tmp6, xmask)
    tl.store(out_ptr1 + x2, tmp16, xmask)


@triton.jit
def triton_poi_fused_convolution_relu_threshold_backward_3(in_out_ptr0,
    in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_out_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr0 + x1, xmask, 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(in_out_ptr0 + x2, tmp4, xmask)
    tl.store(out_ptr0 + x2, tmp6, xmask)


@triton.jit
def triton_poi_fused__to_copy_4(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = x0
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 0.015873015873015872
    tmp3 = tmp1 * tmp2
    tmp4 = 0.0
    tmp5 = triton_helpers.maximum(tmp3, tmp4)
    tmp6 = tmp5.to(tl.int32)
    tl.store(out_ptr0 + x0, tmp6, xmask)


@triton.jit
def triton_poi_fused_add_clamp_5(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = x0
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 0.015873015873015872
    tmp3 = tmp1 * tmp2
    tmp4 = 0.0
    tmp5 = triton_helpers.maximum(tmp3, tmp4)
    tmp6 = tmp5.to(tl.int32)
    tmp7 = tl.full([1], 1, tl.int64)
    tmp8 = tmp6 + tmp7
    tmp9 = triton_helpers.minimum(tmp8, tmp7)
    tl.store(out_ptr0 + x0, tmp9, xmask)


@triton.jit
def triton_poi_fused__to_copy_arange_clamp_mul_sub_6(out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = x0
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 0.015873015873015872
    tmp3 = tmp1 * tmp2
    tmp4 = 0.0
    tmp5 = triton_helpers.maximum(tmp3, tmp4)
    tmp6 = tmp5.to(tl.int32)
    tmp7 = tmp6.to(tl.float32)
    tmp8 = tmp5 - tmp7
    tmp9 = triton_helpers.maximum(tmp8, tmp4)
    tmp10 = 1.0
    tmp11 = triton_helpers.minimum(tmp9, tmp10)
    tl.store(out_ptr0 + x0, tmp11, xmask)


@triton.jit
def triton_poi_fused__unsafe_index_add_mul_sub_7(in_out_ptr0, in_ptr0,
    in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5, in_ptr6, in_ptr7, 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
    x0 = xindex % 64
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + x1, None, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr1 + x0, None, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr3 + 0)
    tmp11 = tl.broadcast_to(tmp10, [XBLOCK])
    tmp13 = tl.load(in_ptr4 + x0, None, eviction_policy='evict_last')
    tmp20 = tl.load(in_ptr5 + x0, None, eviction_policy='evict_last')
    tmp23 = tl.load(in_ptr6 + x1, None, eviction_policy='evict_last')
    tmp35 = tl.load(in_ptr7 + x1, None, eviction_policy='evict_last')
    tmp1 = tl.full([XBLOCK], 2, tl.int32)
    tmp2 = tmp0 + tmp1
    tmp3 = tmp0 < 0
    tmp4 = tl.where(tmp3, tmp2, tmp0)
    tmp6 = tmp5 + tmp1
    tmp7 = tmp5 < 0
    tmp8 = tl.where(tmp7, tmp6, tmp5)
    tmp9 = tl.load(in_ptr2 + (tmp8 + 2 * tmp4), None, eviction_policy=
        'evict_last')
    tmp12 = tmp9 + tmp11
    tmp14 = tmp13 + tmp1
    tmp15 = tmp13 < 0
    tmp16 = tl.where(tmp15, tmp14, tmp13)
    tmp17 = tl.load(in_ptr2 + (tmp16 + 2 * tmp4), None, eviction_policy=
        'evict_last')
    tmp18 = tmp17 + tmp11
    tmp19 = tmp18 - tmp12
    tmp21 = tmp19 * tmp20
    tmp22 = tmp12 + tmp21
    tmp24 = tmp23 + tmp1
    tmp25 = tmp23 < 0
    tmp26 = tl.where(tmp25, tmp24, tmp23)
    tmp27 = tl.load(in_ptr2 + (tmp8 + 2 * tmp26), None, eviction_policy=
        'evict_last')
    tmp28 = tmp27 + tmp11
    tmp29 = tl.load(in_ptr2 + (tmp16 + 2 * tmp26), None, eviction_policy=
        'evict_last')
    tmp30 = tmp29 + tmp11
    tmp31 = tmp30 - tmp28
    tmp32 = tmp31 * tmp20
    tmp33 = tmp28 + tmp32
    tmp34 = tmp33 - tmp22
    tmp36 = tmp34 * tmp35
    tmp37 = tmp22 + tmp36
    tl.store(in_out_ptr0 + x2, tmp37, None)


@triton.jit
def triton_poi_fused__to_copy_8(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 4
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = x0
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 21.0
    tmp3 = tmp1 * tmp2
    tmp4 = 0.0
    tmp5 = triton_helpers.maximum(tmp3, tmp4)
    tmp6 = tmp5.to(tl.int32)
    tl.store(out_ptr0 + x0, tmp6, xmask)


@triton.jit
def triton_poi_fused_add_clamp_9(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 4
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = x0
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 21.0
    tmp3 = tmp1 * tmp2
    tmp4 = 0.0
    tmp5 = triton_helpers.maximum(tmp3, tmp4)
    tmp6 = tmp5.to(tl.int32)
    tmp7 = tl.full([1], 1, tl.int64)
    tmp8 = tmp6 + tmp7
    tmp9 = tl.full([1], 63, tl.int64)
    tmp10 = triton_helpers.minimum(tmp8, tmp9)
    tl.store(out_ptr0 + x0, tmp10, xmask)


@triton.jit
def triton_poi_fused__to_copy_arange_clamp_mul_sub_10(out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 4
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = x0
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 21.0
    tmp3 = tmp1 * tmp2
    tmp4 = 0.0
    tmp5 = triton_helpers.maximum(tmp3, tmp4)
    tmp6 = tmp5.to(tl.int32)
    tmp7 = tmp6.to(tl.float32)
    tmp8 = tmp5 - tmp7
    tmp9 = triton_helpers.maximum(tmp8, tmp4)
    tmp10 = 1.0
    tmp11 = triton_helpers.minimum(tmp9, tmp10)
    tl.store(out_ptr0 + x0, tmp11, xmask)


@triton.jit
def triton_poi_fused__unsafe_index_add_convolution_mul_sub_11(in_ptr0,
    in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5, in_ptr6, in_ptr7, out_ptr0,
    out_ptr1, xnumel, XBLOCK: tl.constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 4
    x0 = xindex % 4
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + x1, xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr1 + x0, xmask, eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr3 + 0)
    tmp11 = tl.broadcast_to(tmp10, [XBLOCK])
    tmp13 = tl.load(in_ptr4 + x0, xmask, eviction_policy='evict_last')
    tmp20 = tl.load(in_ptr5 + x0, xmask, eviction_policy='evict_last')
    tmp23 = tl.load(in_ptr6 + x1, xmask, eviction_policy='evict_last')
    tmp35 = tl.load(in_ptr7 + x1, xmask, eviction_policy='evict_last')
    tmp1 = tl.full([XBLOCK], 64, tl.int32)
    tmp2 = tmp0 + tmp1
    tmp3 = tmp0 < 0
    tmp4 = tl.where(tmp3, tmp2, tmp0)
    tmp6 = tmp5 + tmp1
    tmp7 = tmp5 < 0
    tmp8 = tl.where(tmp7, tmp6, tmp5)
    tmp9 = tl.load(in_ptr2 + (tmp8 + 64 * tmp4), xmask, eviction_policy=
        'evict_last')
    tmp12 = tmp9 + tmp11
    tmp14 = tmp13 + tmp1
    tmp15 = tmp13 < 0
    tmp16 = tl.where(tmp15, tmp14, tmp13)
    tmp17 = tl.load(in_ptr2 + (tmp16 + 64 * tmp4), xmask, eviction_policy=
        'evict_last')
    tmp18 = tmp17 + tmp11
    tmp19 = tmp18 - tmp12
    tmp21 = tmp19 * tmp20
    tmp22 = tmp12 + tmp21
    tmp24 = tmp23 + tmp1
    tmp25 = tmp23 < 0
    tmp26 = tl.where(tmp25, tmp24, tmp23)
    tmp27 = tl.load(in_ptr2 + (tmp8 + 64 * tmp26), xmask, eviction_policy=
        'evict_last')
    tmp28 = tmp27 + tmp11
    tmp29 = tl.load(in_ptr2 + (tmp16 + 64 * tmp26), xmask, eviction_policy=
        'evict_last')
    tmp30 = tmp29 + tmp11
    tmp31 = tmp30 - tmp28
    tmp32 = tmp31 * tmp20
    tmp33 = tmp28 + tmp32
    tmp34 = tmp33 - tmp22
    tmp36 = tmp34 * tmp35
    tl.store(out_ptr0 + x2, tmp22, xmask)
    tl.store(out_ptr1 + x2, tmp36, xmask)


@triton.jit
def triton_poi_fused_sigmoid_12(in_ptr0, in_ptr1, in_ptr2, out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 4
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + x1, xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr2 + x2, xmask)
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 * tmp3
    tmp5 = tl.sigmoid(tmp4)
    tl.store(out_ptr0 + x2, tmp5, xmask)


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, (4, 4, 4), (16, 4, 1))
    assert_size_stride(primals_2, (4, 4, 4), (16, 4, 1))
    assert_size_stride(primals_3, (4, 4, 4), (16, 4, 1))
    assert_size_stride(primals_4, (4, 4, 4), (16, 4, 1))
    assert_size_stride(primals_5, (64, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_6, (64,), (1,))
    assert_size_stride(primals_7, (4, 64, 3, 3), (576, 9, 3, 1))
    assert_size_stride(primals_8, (4,), (1,))
    assert_size_stride(primals_9, (64, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_10, (64,), (1,))
    assert_size_stride(primals_11, (4, 64, 3, 3), (576, 9, 3, 1))
    assert_size_stride(primals_12, (4,), (1,))
    assert_size_stride(primals_13, (1, 4, 4), (16, 4, 1))
    assert_size_stride(primals_14, (1,), (1,))
    assert_size_stride(primals_15, (1, 1, 3, 3), (9, 9, 3, 1))
    assert_size_stride(primals_16, (1,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(primals_4, (4, 4, 4), (1, 4, 
            16), 0), reinterpret_tensor(primals_1, (4, 4, 4), (1, 16, 4), 0
            ), out=buf0)
        del primals_4
        buf1 = buf0
        del buf0
        get_raw_stream(0)
        triton_poi_fused_leaky_relu_0[grid(64)](buf1, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf2 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        extern_kernels.bmm(reinterpret_tensor(primals_3, (4, 4, 4), (1, 4, 
            16), 0), reinterpret_tensor(primals_1, (4, 4, 4), (1, 16, 4), 0
            ), out=buf2)
        del primals_1
        del primals_3
        buf3 = buf2
        del buf2
        triton_poi_fused_leaky_relu_0[grid(64)](buf3, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf4 = extern_kernels.convolution(reinterpret_tensor(buf1, (1, 4, 4,
            4), (0, 16, 4, 1), 0), primals_5, stride=(1, 1), padding=(1, 1),
            dilation=(1, 1), transposed=False, output_padding=(0, 0),
            groups=1, bias=None)
        assert_size_stride(buf4, (1, 64, 4, 4), (1024, 16, 4, 1))
        buf5 = buf4
        del buf4
        triton_poi_fused_convolution_relu_1[grid(1024)](buf5, primals_6, 
            1024, XBLOCK=256, num_warps=4, num_stages=1)
        del primals_6
        buf6 = empty_strided_cuda((1, 64, 2, 2), (256, 4, 2, 1), torch.float32)
        buf7 = empty_strided_cuda((1, 64, 2, 2), (256, 4, 2, 1), torch.int8)
        triton_poi_fused_max_pool2d_with_indices_2[grid(256)](buf5, buf6,
            buf7, 256, XBLOCK=128, num_warps=4, num_stages=1)
        buf8 = extern_kernels.convolution(buf6, primals_7, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf8, (1, 4, 2, 2), (16, 4, 2, 1))
        buf9 = extern_kernels.convolution(reinterpret_tensor(buf3, (1, 4, 4,
            4), (0, 16, 4, 1), 0), primals_9, stride=(1, 1), padding=(1, 1),
            dilation=(1, 1), transposed=False, output_padding=(0, 0),
            groups=1, bias=None)
        assert_size_stride(buf9, (1, 64, 4, 4), (1024, 16, 4, 1))
        buf10 = buf9
        del buf9
        triton_poi_fused_convolution_relu_1[grid(1024)](buf10, primals_10, 
            1024, XBLOCK=256, num_warps=4, num_stages=1)
        del primals_10
        buf11 = empty_strided_cuda((1, 64, 2, 2), (256, 4, 2, 1), torch.float32
            )
        buf12 = empty_strided_cuda((1, 64, 2, 2), (256, 4, 2, 1), torch.int8)
        triton_poi_fused_max_pool2d_with_indices_2[grid(256)](buf10, buf11,
            buf12, 256, XBLOCK=128, num_warps=4, num_stages=1)
        buf13 = extern_kernels.convolution(buf11, primals_11, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf13, (1, 4, 2, 2), (16, 4, 2, 1))
        buf14 = buf8
        del buf8
        buf38 = empty_strided_cuda((1, 4, 2, 2), (16, 4, 2, 1), torch.bool)
        triton_poi_fused_convolution_relu_threshold_backward_3[grid(16)](buf14,
            primals_8, buf38, 16, XBLOCK=16, num_warps=1, num_stages=1)
        del primals_8
        buf15 = buf13
        del buf13
        buf37 = empty_strided_cuda((1, 4, 2, 2), (16, 4, 2, 1), torch.bool)
        triton_poi_fused_convolution_relu_threshold_backward_3[grid(16)](buf15,
            primals_12, buf37, 16, XBLOCK=16, num_warps=1, num_stages=1)
        del primals_12
        buf16 = torch.ops.aten._trilinear.default(reinterpret_tensor(buf14,
            (4, 4), (4, 1), 0), primals_13, reinterpret_tensor(buf15, (4, 4
            ), (4, 1), 0), [1, 3], [0], [1, 2], [2, 3])
        buf17 = buf16
        del buf16
        buf18 = empty_strided_cuda((64, 1), (1, 1), torch.int64)
        triton_poi_fused__to_copy_4[grid(64)](buf18, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf19 = empty_strided_cuda((64, 1), (1, 1), torch.int64)
        triton_poi_fused_add_clamp_5[grid(64)](buf19, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf20 = empty_strided_cuda((64,), (1,), torch.int64)
        triton_poi_fused__to_copy_4[grid(64)](buf20, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf21 = empty_strided_cuda((64,), (1,), torch.int64)
        triton_poi_fused_add_clamp_5[grid(64)](buf21, 64, XBLOCK=64,
            num_warps=1, num_stages=1)
        buf22 = empty_strided_cuda((64,), (1,), torch.float32)
        triton_poi_fused__to_copy_arange_clamp_mul_sub_6[grid(64)](buf22, 
            64, XBLOCK=64, num_warps=1, num_stages=1)
        buf24 = empty_strided_cuda((64, 1), (1, 1), torch.float32)
        triton_poi_fused__to_copy_arange_clamp_mul_sub_6[grid(64)](buf24, 
            64, XBLOCK=64, num_warps=1, num_stages=1)
        buf25 = empty_strided_cuda((1, 1, 64, 64), (4096, 4096, 64, 1),
            torch.float32)
        buf26 = buf25
        del buf25
        triton_poi_fused__unsafe_index_add_mul_sub_7[grid(4096)](buf26,
            buf18, buf20, buf17, primals_14, buf21, buf22, buf19, buf24, 
            4096, XBLOCK=256, num_warps=4, num_stages=1)
        del primals_14
        buf27 = extern_kernels.convolution(buf26, primals_15, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf27, (1, 1, 64, 64), (4096, 4096, 64, 1))
        buf28 = empty_strided_cuda((4, 1), (1, 1), torch.int64)
        triton_poi_fused__to_copy_8[grid(4)](buf28, 4, XBLOCK=4, num_warps=
            1, num_stages=1)
        buf29 = empty_strided_cuda((4, 1), (1, 1), torch.int64)
        triton_poi_fused_add_clamp_9[grid(4)](buf29, 4, XBLOCK=4, num_warps
            =1, num_stages=1)
        buf30 = empty_strided_cuda((4,), (1,), torch.int64)
        triton_poi_fused__to_copy_8[grid(4)](buf30, 4, XBLOCK=4, num_warps=
            1, num_stages=1)
        buf31 = empty_strided_cuda((4,), (1,), torch.int64)
        triton_poi_fused_add_clamp_9[grid(4)](buf31, 4, XBLOCK=4, num_warps
            =1, num_stages=1)
        buf32 = reinterpret_tensor(buf17, (4,), (1,), 0)
        del buf17
        triton_poi_fused__to_copy_arange_clamp_mul_sub_10[grid(4)](buf32, 4,
            XBLOCK=4, num_warps=1, num_stages=1)
        buf34 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        triton_poi_fused__to_copy_arange_clamp_mul_sub_10[grid(4)](buf34, 4,
            XBLOCK=4, num_warps=1, num_stages=1)
        buf33 = empty_strided_cuda((1, 1, 4, 4), (16, 16, 4, 1), torch.float32)
        buf35 = empty_strided_cuda((1, 1, 4, 4), (16, 16, 4, 1), torch.float32)
        triton_poi_fused__unsafe_index_add_convolution_mul_sub_11[grid(16)](
            buf28, buf30, buf27, primals_16, buf31, buf32, buf29, buf34,
            buf33, buf35, 16, XBLOCK=16, num_warps=1, num_stages=1)
        del buf27
        del primals_16
        buf36 = empty_strided_cuda((4, 4, 4, 1), (16, 4, 1, 1), torch.float32)
        triton_poi_fused_sigmoid_12[grid(64)](buf33, buf35, primals_2,
            buf36, 64, XBLOCK=64, num_warps=1, num_stages=1)
        del buf33
        del buf35
    return (buf36, primals_2, primals_5, primals_7, primals_9, primals_11,
        primals_13, primals_15, reinterpret_tensor(buf1, (1, 4, 4, 4), (64,
        16, 4, 1), 0), reinterpret_tensor(buf3, (1, 4, 4, 4), (64, 16, 4, 1
        ), 0), buf5, buf6, buf7, buf10, buf11, buf12, reinterpret_tensor(
        buf14, (4, 4), (4, 1), 0), reinterpret_tensor(buf15, (4, 4), (4, 1),
        0), buf18, buf19, buf20, buf21, buf22, buf24, buf26, buf28, buf29,
        buf30, buf31, buf32, buf34, buf36, buf37, buf38)


class CO_AttentionNew(nn.Module):

    def __init__(self, in_dim, co_attention_dim):
        super(CO_AttentionNew, self).__init__()
        self.leak_relu = nn.LeakyReLU()
        self.relu = nn.ReLU()
        self.conv1 = nn.Conv2d(in_dim, 64, kernel_size=3, padding=1)
        self.conv2 = nn.Conv2d(64, co_attention_dim, kernel_size=3, padding=1)
        self.pool = torch.nn.MaxPool2d(kernel_size=2)
        self.gate1 = nn.Sequential(self.conv1, self.relu, self.pool, self.
            conv2, self.relu)
        self.conv3 = nn.Conv2d(in_dim, 64, kernel_size=3, padding=1)
        self.conv4 = nn.Conv2d(64, co_attention_dim, kernel_size=3, padding=1)
        self.gate2 = nn.Sequential(self.conv3, self.relu, self.pool, self.
            conv4, self.relu)
        self.bilinear = torch.nn.Bilinear(co_attention_dim, co_attention_dim, 1
            )
        self.conv = nn.Conv2d(1, 1, kernel_size=3, padding=1)
        self.sigmoid = nn.Sigmoid()

    def forward(self, input_0, input_1, input_2, input_3):
        primals_5 = self.conv1.weight
        primals_6 = self.conv1.bias
        primals_7 = self.conv2.weight
        primals_8 = self.conv2.bias
        primals_9 = self.conv3.weight
        primals_10 = self.conv3.bias
        primals_11 = self.conv4.weight
        primals_12 = self.conv4.bias
        primals_13 = self.bilinear.weight
        primals_14 = self.bilinear.bias
        primals_15 = self.conv.weight
        primals_16 = self.conv.bias
        primals_1 = input_0
        primals_2 = input_1
        primals_3 = input_2
        primals_4 = input_3
        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.058623