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
import torch.nn.functional as F
import torch.utils.data.dataset
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_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 // 4096 % 4
    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)
    tl.store(out_ptr0 + x3, tmp4, None)


@triton.jit
def triton_poi_fused_convolution_relu_1(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 // 4096 % 4
    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_convolution_relu_2(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 // 16384 % 4
    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)
    tl.store(out_ptr0 + x3, tmp4, None)


@triton.jit
def triton_poi_fused_convolution_relu_3(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 // 16384 % 4
    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__to_copy_4(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 128
    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.5
    tmp3 = tmp1 + tmp2
    tmp4 = tmp3 * tmp2
    tmp5 = tmp4 - tmp2
    tmp6 = 0.0
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp7.to(tl.int32)
    tl.store(out_ptr0 + x0, tmp8, xmask)


@triton.jit
def triton_poi_fused_add_clamp_5(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 128
    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.5
    tmp3 = tmp1 + tmp2
    tmp4 = tmp3 * tmp2
    tmp5 = tmp4 - tmp2
    tmp6 = 0.0
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp7.to(tl.int32)
    tmp9 = tl.full([1], 1, tl.int64)
    tmp10 = tmp8 + tmp9
    tmp11 = tl.full([1], 63, tl.int64)
    tmp12 = triton_helpers.minimum(tmp10, tmp11)
    tl.store(out_ptr0 + x0, tmp12, xmask)


@triton.jit
def triton_poi_fused__to_copy_add_arange_clamp_mul_sub_6(out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 128
    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.5
    tmp3 = tmp1 + tmp2
    tmp4 = tmp3 * tmp2
    tmp5 = tmp4 - tmp2
    tmp6 = 0.0
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp7.to(tl.int32)
    tmp9 = tmp8.to(tl.float32)
    tmp10 = tmp7 - tmp9
    tmp11 = triton_helpers.maximum(tmp10, tmp6)
    tmp12 = 1.0
    tmp13 = triton_helpers.minimum(tmp11, tmp12)
    tl.store(out_ptr0 + x0, tmp13, xmask)


@triton.jit
def triton_poi_fused__unsafe_index_add_convolution_mul_relu_sub_7(in_out_ptr1,
    in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5, in_ptr6, in_ptr7,
    in_ptr8, in_ptr9, in_ptr10, in_ptr11, in_ptr12, in_ptr13, 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 // 128 % 128
    x0 = xindex % 128
    x6 = xindex // 16384
    x2 = xindex // 16384 % 4
    x4 = 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 + x2, None, eviction_policy='evict_last')
    tmp13 = tl.load(in_ptr5 + x2, None, eviction_policy='evict_last')
    tmp16 = tl.load(in_ptr6 + x1, None, eviction_policy='evict_last')
    tmp25 = tl.load(in_ptr7 + x0, None, eviction_policy='evict_last')
    tmp35 = tl.load(in_ptr8 + x0, None, eviction_policy='evict_last')
    tmp47 = tl.load(in_ptr9 + x4, None)
    tmp48 = tl.load(in_ptr10 + x2, None, eviction_policy='evict_last')
    tmp50 = tl.load(in_ptr11 + x4, None)
    tmp51 = tl.load(in_ptr12 + x2, None, eviction_policy='evict_last')
    tmp54 = tl.load(in_ptr13 + x1, None, 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 + 4096 * x6), None,
        eviction_policy='evict_last')
    tmp11 = tmp9 + tmp10
    tmp12 = tl.load(in_ptr4 + (tmp8 + 64 * tmp4 + 4096 * x6), None,
        eviction_policy='evict_last')
    tmp14 = tmp12 + tmp13
    tmp15 = tmp11 + tmp14
    tmp17 = tmp16 + tmp1
    tmp18 = tmp16 < 0
    tmp19 = tl.where(tmp18, tmp17, tmp16)
    tmp20 = tl.load(in_ptr2 + (tmp8 + 64 * tmp19 + 4096 * x6), None,
        eviction_policy='evict_last')
    tmp21 = tmp20 + tmp10
    tmp22 = tl.load(in_ptr4 + (tmp8 + 64 * tmp19 + 4096 * x6), None,
        eviction_policy='evict_last')
    tmp23 = tmp22 + tmp13
    tmp24 = tmp21 + tmp23
    tmp26 = tmp25 + tmp1
    tmp27 = tmp25 < 0
    tmp28 = tl.where(tmp27, tmp26, tmp25)
    tmp29 = tl.load(in_ptr2 + (tmp28 + 64 * tmp19 + 4096 * x6), None,
        eviction_policy='evict_last')
    tmp30 = tmp29 + tmp10
    tmp31 = tl.load(in_ptr4 + (tmp28 + 64 * tmp19 + 4096 * x6), None,
        eviction_policy='evict_last')
    tmp32 = tmp31 + tmp13
    tmp33 = tmp30 + tmp32
    tmp34 = tmp33 - tmp24
    tmp36 = tmp34 * tmp35
    tmp37 = tmp24 + tmp36
    tmp38 = tl.load(in_ptr2 + (tmp28 + 64 * tmp4 + 4096 * x6), None,
        eviction_policy='evict_last')
    tmp39 = tmp38 + tmp10
    tmp40 = tl.load(in_ptr4 + (tmp28 + 64 * tmp4 + 4096 * x6), None,
        eviction_policy='evict_last')
    tmp41 = tmp40 + tmp13
    tmp42 = tmp39 + tmp41
    tmp43 = tmp42 - tmp15
    tmp44 = tmp43 * tmp35
    tmp45 = tmp15 + tmp44
    tmp46 = tmp45 - tmp37
    tmp49 = tmp47 + tmp48
    tmp52 = tmp50 + tmp51
    tmp53 = tmp49 + tmp52
    tmp55 = tmp46 * tmp54
    tmp56 = tmp37 + tmp55
    tmp57 = tmp53 + tmp56
    tmp58 = tl.full([1], 0, tl.int32)
    tmp59 = triton_helpers.maximum(tmp58, tmp57)
    tl.store(in_out_ptr1 + x4, tmp57, None)
    tl.store(out_ptr0 + x4, tmp59, None)


@triton.jit
def triton_poi_fused_convolution_relu_8(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 // 65536 % 4
    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)
    tl.store(out_ptr0 + x3, tmp4, None)


@triton.jit
def triton_poi_fused_convolution_relu_9(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 // 65536 % 4
    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__to_copy_10(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    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.5
    tmp3 = tmp1 + tmp2
    tmp4 = tmp3 * tmp2
    tmp5 = tmp4 - tmp2
    tmp6 = 0.0
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp7.to(tl.int32)
    tl.store(out_ptr0 + x0, tmp8, xmask)


@triton.jit
def triton_poi_fused_add_clamp_11(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    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.5
    tmp3 = tmp1 + tmp2
    tmp4 = tmp3 * tmp2
    tmp5 = tmp4 - tmp2
    tmp6 = 0.0
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp7.to(tl.int32)
    tmp9 = tl.full([1], 1, tl.int64)
    tmp10 = tmp8 + tmp9
    tmp11 = tl.full([1], 127, tl.int64)
    tmp12 = triton_helpers.minimum(tmp10, tmp11)
    tl.store(out_ptr0 + x0, tmp12, xmask)


@triton.jit
def triton_poi_fused__to_copy_add_arange_clamp_mul_sub_12(out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 256
    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.5
    tmp3 = tmp1 + tmp2
    tmp4 = tmp3 * tmp2
    tmp5 = tmp4 - tmp2
    tmp6 = 0.0
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp7.to(tl.int32)
    tmp9 = tmp8.to(tl.float32)
    tmp10 = tmp7 - tmp9
    tmp11 = triton_helpers.maximum(tmp10, tmp6)
    tmp12 = 1.0
    tmp13 = triton_helpers.minimum(tmp11, tmp12)
    tl.store(out_ptr0 + x0, tmp13, xmask)


@triton.jit
def triton_poi_fused__unsafe_index_add_convolution_mul_relu_sub_13(in_out_ptr2,
    in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5, in_ptr6, in_ptr7,
    in_ptr8, in_ptr9, in_ptr10, in_ptr11, 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 // 256 % 256
    x0 = xindex % 256
    x6 = xindex // 65536
    x2 = xindex // 65536 % 4
    x5 = xindex
    tmp0 = tl.load(in_ptr0 + x1, None, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr1 + x0, None, eviction_policy='evict_last')
    tmp11 = tl.load(in_ptr4 + x2, None, eviction_policy='evict_last')
    tmp14 = tl.load(in_ptr5 + x1, None, eviction_policy='evict_last')
    tmp22 = tl.load(in_ptr6 + x0, None, eviction_policy='evict_last')
    tmp31 = tl.load(in_ptr7 + x0, None, eviction_policy='evict_last')
    tmp42 = tl.load(in_ptr8 + x1, None, eviction_policy='evict_last')
    tmp44 = tl.load(in_out_ptr2 + x5, None)
    tmp45 = tl.load(in_ptr9 + x2, None, eviction_policy='evict_last')
    tmp47 = tl.load(in_ptr10 + x5, None)
    tmp48 = tl.load(in_ptr11 + x2, None, eviction_policy='evict_last')
    tmp1 = tl.full([XBLOCK], 128, 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 + 128 * tmp4 + 16384 * x6), None,
        eviction_policy='evict_last')
    tmp10 = tl.load(in_ptr3 + (tmp8 + 128 * tmp4 + 16384 * x6), None,
        eviction_policy='evict_last')
    tmp12 = tmp10 + tmp11
    tmp13 = tmp9 + tmp12
    tmp15 = tmp14 + tmp1
    tmp16 = tmp14 < 0
    tmp17 = tl.where(tmp16, tmp15, tmp14)
    tmp18 = tl.load(in_ptr2 + (tmp8 + 128 * tmp17 + 16384 * x6), None,
        eviction_policy='evict_last')
    tmp19 = tl.load(in_ptr3 + (tmp8 + 128 * tmp17 + 16384 * x6), None,
        eviction_policy='evict_last')
    tmp20 = tmp19 + tmp11
    tmp21 = tmp18 + tmp20
    tmp23 = tmp22 + tmp1
    tmp24 = tmp22 < 0
    tmp25 = tl.where(tmp24, tmp23, tmp22)
    tmp26 = tl.load(in_ptr2 + (tmp25 + 128 * tmp17 + 16384 * x6), None,
        eviction_policy='evict_last')
    tmp27 = tl.load(in_ptr3 + (tmp25 + 128 * tmp17 + 16384 * x6), None,
        eviction_policy='evict_last')
    tmp28 = tmp27 + tmp11
    tmp29 = tmp26 + tmp28
    tmp30 = tmp29 - tmp21
    tmp32 = tmp30 * tmp31
    tmp33 = tmp21 + tmp32
    tmp34 = tl.load(in_ptr2 + (tmp25 + 128 * tmp4 + 16384 * x6), None,
        eviction_policy='evict_last')
    tmp35 = tl.load(in_ptr3 + (tmp25 + 128 * tmp4 + 16384 * x6), None,
        eviction_policy='evict_last')
    tmp36 = tmp35 + tmp11
    tmp37 = tmp34 + tmp36
    tmp38 = tmp37 - tmp13
    tmp39 = tmp38 * tmp31
    tmp40 = tmp13 + tmp39
    tmp41 = tmp40 - tmp33
    tmp43 = tmp41 * tmp42
    tmp46 = tmp44 + tmp45
    tmp49 = tmp47 + tmp48
    tmp50 = tmp46 + tmp49
    tmp51 = tmp33 + tmp43
    tmp52 = tmp50 + tmp51
    tmp53 = tl.full([1], 0, tl.int32)
    tmp54 = triton_helpers.maximum(tmp53, tmp52)
    tl.store(in_out_ptr2 + x5, tmp52, None)
    tl.store(out_ptr0 + x5, tmp54, None)


@triton.jit
def triton_poi_fused_add_convolution_relu_14(in_out_ptr0, in_ptr0, in_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 // 65536 % 4
    tmp0 = tl.load(in_out_ptr0 + x3, None)
    tmp1 = tl.load(in_ptr0 + x3, None)
    tmp2 = tl.load(in_ptr1 + x1, None, eviction_policy='evict_last')
    tmp3 = tmp1 + tmp2
    tmp4 = tmp0 + tmp3
    tmp5 = tl.full([1], 0, tl.int32)
    tmp6 = triton_helpers.maximum(tmp5, tmp4)
    tl.store(in_out_ptr0 + x3, tmp6, None)


@triton.jit
def triton_poi_fused__to_copy_15(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 1024
    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.5
    tmp3 = tmp1 + tmp2
    tmp4 = 0.25
    tmp5 = tmp3 * tmp4
    tmp6 = tmp5 - tmp2
    tmp7 = 0.0
    tmp8 = triton_helpers.maximum(tmp6, tmp7)
    tmp9 = tmp8.to(tl.int32)
    tl.store(out_ptr0 + x0, tmp9, xmask)


@triton.jit
def triton_poi_fused_add_clamp_16(out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 1024
    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.5
    tmp3 = tmp1 + tmp2
    tmp4 = 0.25
    tmp5 = tmp3 * tmp4
    tmp6 = tmp5 - tmp2
    tmp7 = 0.0
    tmp8 = triton_helpers.maximum(tmp6, tmp7)
    tmp9 = tmp8.to(tl.int32)
    tmp10 = tl.full([1], 1, tl.int64)
    tmp11 = tmp9 + tmp10
    tmp12 = tl.full([1], 255, tl.int64)
    tmp13 = triton_helpers.minimum(tmp11, tmp12)
    tl.store(out_ptr0 + x0, tmp13, xmask)


@triton.jit
def triton_poi_fused__to_copy_add_arange_clamp_mul_sub_17(out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 1024
    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.5
    tmp3 = tmp1 + tmp2
    tmp4 = 0.25
    tmp5 = tmp3 * tmp4
    tmp6 = tmp5 - tmp2
    tmp7 = 0.0
    tmp8 = triton_helpers.maximum(tmp6, tmp7)
    tmp9 = tmp8.to(tl.int32)
    tmp10 = tmp9.to(tl.float32)
    tmp11 = tmp8 - tmp10
    tmp12 = triton_helpers.maximum(tmp11, tmp7)
    tmp13 = 1.0
    tmp14 = triton_helpers.minimum(tmp12, tmp13)
    tl.store(out_ptr0 + x0, tmp14, xmask)


@triton.jit
def triton_poi_fused__unsafe_index_add_convolution_mul_sub_18(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 // 1024 % 1024
    x0 = xindex % 1024
    x6 = xindex // 1048576
    x2 = xindex // 1048576 % 2
    x4 = 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 + x2, None, eviction_policy='evict_last')
    tmp12 = tl.load(in_ptr4 + x0, None, eviction_policy='evict_last')
    tmp19 = tl.load(in_ptr5 + x0, None, eviction_policy='evict_last')
    tmp22 = tl.load(in_ptr6 + x1, None, eviction_policy='evict_last')
    tmp34 = tl.load(in_ptr7 + x1, None, eviction_policy='evict_last')
    tmp1 = tl.full([XBLOCK], 256, 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 + 256 * tmp4 + 65536 * x6), None,
        eviction_policy='evict_last')
    tmp11 = tmp9 + tmp10
    tmp13 = tmp12 + tmp1
    tmp14 = tmp12 < 0
    tmp15 = tl.where(tmp14, tmp13, tmp12)
    tmp16 = tl.load(in_ptr2 + (tmp15 + 256 * tmp4 + 65536 * x6), None,
        eviction_policy='evict_last')
    tmp17 = tmp16 + tmp10
    tmp18 = tmp17 - tmp11
    tmp20 = tmp18 * tmp19
    tmp21 = tmp11 + tmp20
    tmp23 = tmp22 + tmp1
    tmp24 = tmp22 < 0
    tmp25 = tl.where(tmp24, tmp23, tmp22)
    tmp26 = tl.load(in_ptr2 + (tmp8 + 256 * tmp25 + 65536 * x6), None,
        eviction_policy='evict_last')
    tmp27 = tmp26 + tmp10
    tmp28 = tl.load(in_ptr2 + (tmp15 + 256 * tmp25 + 65536 * x6), None,
        eviction_policy='evict_last')
    tmp29 = tmp28 + tmp10
    tmp30 = tmp29 - tmp27
    tmp31 = tmp30 * tmp19
    tmp32 = tmp27 + tmp31
    tmp33 = tmp32 - tmp21
    tmp35 = tmp33 * tmp34
    tmp36 = tmp21 + tmp35
    tl.store(in_out_ptr0 + x4, tmp36, 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, primals_22,
        primals_23, primals_24, primals_25, primals_26, primals_27,
        primals_28, primals_29, primals_30, primals_31) = args
    args.clear()
    assert_size_stride(primals_1, (4, 1024, 3, 3), (9216, 9, 3, 1))
    assert_size_stride(primals_2, (4,), (1,))
    assert_size_stride(primals_3, (4, 1024, 64, 64), (4194304, 4096, 64, 1))
    assert_size_stride(primals_4, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_5, (4,), (1,))
    assert_size_stride(primals_6, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_7, (4,), (1,))
    assert_size_stride(primals_8, (4, 512, 3, 3), (4608, 9, 3, 1))
    assert_size_stride(primals_9, (4,), (1,))
    assert_size_stride(primals_10, (4, 512, 128, 128), (8388608, 16384, 128, 1)
        )
    assert_size_stride(primals_11, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_12, (4,), (1,))
    assert_size_stride(primals_13, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_14, (4,), (1,))
    assert_size_stride(primals_15, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_16, (4,), (1,))
    assert_size_stride(primals_17, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_18, (4,), (1,))
    assert_size_stride(primals_19, (4, 256, 3, 3), (2304, 9, 3, 1))
    assert_size_stride(primals_20, (4,), (1,))
    assert_size_stride(primals_21, (4, 256, 256, 256), (16777216, 65536, 
        256, 1))
    assert_size_stride(primals_22, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_23, (4,), (1,))
    assert_size_stride(primals_24, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_25, (4,), (1,))
    assert_size_stride(primals_26, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_27, (4,), (1,))
    assert_size_stride(primals_28, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_29, (4,), (1,))
    assert_size_stride(primals_30, (2, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_31, (2,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = extern_kernels.convolution(primals_3, 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, 4, 64, 64), (16384, 4096, 64, 1))
        buf1 = empty_strided_cuda((4, 4, 64, 64), (16384, 4096, 64, 1),
            torch.float32)
        get_raw_stream(0)
        triton_poi_fused_convolution_relu_0[grid(65536)](buf0, primals_2,
            buf1, 65536, XBLOCK=512, num_warps=4, num_stages=1)
        buf2 = extern_kernels.convolution(buf1, primals_4, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf2, (4, 4, 64, 64), (16384, 4096, 64, 1))
        buf3 = buf2
        del buf2
        triton_poi_fused_convolution_relu_1[grid(65536)](buf3, primals_5, 
            65536, XBLOCK=512, num_warps=4, num_stages=1)
        del primals_5
        buf4 = extern_kernels.convolution(buf3, primals_6, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf4, (4, 4, 64, 64), (16384, 4096, 64, 1))
        buf5 = extern_kernels.convolution(primals_10, primals_8, stride=(1,
            1), padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf5, (4, 4, 128, 128), (65536, 16384, 128, 1))
        buf6 = empty_strided_cuda((4, 4, 128, 128), (65536, 16384, 128, 1),
            torch.float32)
        triton_poi_fused_convolution_relu_2[grid(262144)](buf5, primals_9,
            buf6, 262144, XBLOCK=1024, num_warps=4, num_stages=1)
        buf7 = extern_kernels.convolution(buf6, primals_11, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf7, (4, 4, 128, 128), (65536, 16384, 128, 1))
        buf8 = buf7
        del buf7
        triton_poi_fused_convolution_relu_3[grid(262144)](buf8, primals_12,
            262144, XBLOCK=512, num_warps=8, num_stages=1)
        del primals_12
        buf9 = extern_kernels.convolution(buf8, primals_13, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf9, (4, 4, 128, 128), (65536, 16384, 128, 1))
        buf10 = empty_strided_cuda((128, 1), (1, 1), torch.int64)
        triton_poi_fused__to_copy_4[grid(128)](buf10, 128, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf11 = empty_strided_cuda((128, 1), (1, 1), torch.int64)
        triton_poi_fused_add_clamp_5[grid(128)](buf11, 128, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf12 = empty_strided_cuda((128,), (1,), torch.int64)
        triton_poi_fused__to_copy_4[grid(128)](buf12, 128, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf13 = empty_strided_cuda((128,), (1,), torch.int64)
        triton_poi_fused_add_clamp_5[grid(128)](buf13, 128, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf16 = empty_strided_cuda((128,), (1,), torch.float32)
        triton_poi_fused__to_copy_add_arange_clamp_mul_sub_6[grid(128)](buf16,
            128, XBLOCK=128, num_warps=4, num_stages=1)
        buf18 = empty_strided_cuda((128, 1), (1, 1), torch.float32)
        triton_poi_fused__to_copy_add_arange_clamp_mul_sub_6[grid(128)](buf18,
            128, XBLOCK=128, num_warps=4, num_stages=1)
        buf15 = empty_strided_cuda((4, 4, 128, 128), (65536, 16384, 128, 1),
            torch.float32)
        buf19 = buf15
        del buf15
        buf20 = buf19
        del buf19
        buf21 = empty_strided_cuda((4, 4, 128, 128), (65536, 16384, 128, 1),
            torch.float32)
        triton_poi_fused__unsafe_index_add_convolution_mul_relu_sub_7[grid(
            262144)](buf20, buf11, buf12, buf0, primals_2, buf4, primals_7,
            buf10, buf13, buf16, buf5, primals_9, buf9, primals_14, buf18,
            buf21, 262144, XBLOCK=512, num_warps=8, num_stages=1)
        del buf0
        del buf4
        del buf5
        del buf9
        del primals_14
        del primals_2
        del primals_7
        del primals_9
        buf22 = extern_kernels.convolution(buf21, primals_15, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf22, (4, 4, 128, 128), (65536, 16384, 128, 1))
        buf23 = buf22
        del buf22
        triton_poi_fused_convolution_relu_3[grid(262144)](buf23, primals_16,
            262144, XBLOCK=512, num_warps=8, num_stages=1)
        del primals_16
        buf24 = extern_kernels.convolution(buf23, primals_17, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf24, (4, 4, 128, 128), (65536, 16384, 128, 1))
        buf25 = extern_kernels.convolution(primals_21, primals_19, stride=(
            1, 1), padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf25, (4, 4, 256, 256), (262144, 65536, 256, 1))
        buf26 = empty_strided_cuda((4, 4, 256, 256), (262144, 65536, 256, 1
            ), torch.float32)
        triton_poi_fused_convolution_relu_8[grid(1048576)](buf25,
            primals_20, buf26, 1048576, XBLOCK=1024, num_warps=4, num_stages=1)
        buf27 = extern_kernels.convolution(buf26, primals_22, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf27, (4, 4, 256, 256), (262144, 65536, 256, 1))
        buf28 = buf27
        del buf27
        triton_poi_fused_convolution_relu_9[grid(1048576)](buf28,
            primals_23, 1048576, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_23
        buf29 = extern_kernels.convolution(buf28, primals_24, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf29, (4, 4, 256, 256), (262144, 65536, 256, 1))
        buf30 = empty_strided_cuda((256, 1), (1, 1), torch.int64)
        triton_poi_fused__to_copy_10[grid(256)](buf30, 256, XBLOCK=256,
            num_warps=4, num_stages=1)
        buf31 = empty_strided_cuda((256, 1), (1, 1), torch.int64)
        triton_poi_fused_add_clamp_11[grid(256)](buf31, 256, XBLOCK=256,
            num_warps=4, num_stages=1)
        buf32 = empty_strided_cuda((256,), (1,), torch.int64)
        triton_poi_fused__to_copy_10[grid(256)](buf32, 256, XBLOCK=256,
            num_warps=4, num_stages=1)
        buf33 = empty_strided_cuda((256,), (1,), torch.int64)
        triton_poi_fused_add_clamp_11[grid(256)](buf33, 256, XBLOCK=256,
            num_warps=4, num_stages=1)
        buf36 = empty_strided_cuda((256,), (1,), torch.float32)
        triton_poi_fused__to_copy_add_arange_clamp_mul_sub_12[grid(256)](buf36,
            256, XBLOCK=256, num_warps=4, num_stages=1)
        buf38 = empty_strided_cuda((256, 1), (1, 1), torch.float32)
        triton_poi_fused__to_copy_add_arange_clamp_mul_sub_12[grid(256)](buf38,
            256, XBLOCK=256, num_warps=4, num_stages=1)
        buf40 = buf25
        del buf25
        buf41 = empty_strided_cuda((4, 4, 256, 256), (262144, 65536, 256, 1
            ), torch.float32)
        triton_poi_fused__unsafe_index_add_convolution_mul_relu_sub_13[grid
            (1048576)](buf40, buf31, buf32, buf20, buf24, primals_18, buf30,
            buf33, buf36, buf38, primals_20, buf29, primals_25, buf41, 
            1048576, XBLOCK=512, num_warps=8, num_stages=1)
        del buf20
        del buf24
        del buf29
        del primals_18
        del primals_20
        del primals_25
        buf42 = extern_kernels.convolution(buf41, primals_26, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf42, (4, 4, 256, 256), (262144, 65536, 256, 1))
        buf43 = buf42
        del buf42
        triton_poi_fused_convolution_relu_9[grid(1048576)](buf43,
            primals_27, 1048576, XBLOCK=1024, num_warps=4, num_stages=1)
        del primals_27
        buf44 = extern_kernels.convolution(buf43, primals_28, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf44, (4, 4, 256, 256), (262144, 65536, 256, 1))
        buf45 = buf40
        del buf40
        triton_poi_fused_add_convolution_relu_14[grid(1048576)](buf45,
            buf44, primals_29, 1048576, XBLOCK=1024, num_warps=4, num_stages=1)
        del buf44
        del primals_29
        buf46 = extern_kernels.convolution(buf45, primals_30, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf46, (4, 2, 256, 256), (131072, 65536, 256, 1))
        buf47 = empty_strided_cuda((1024, 1), (1, 1), torch.int64)
        triton_poi_fused__to_copy_15[grid(1024)](buf47, 1024, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf48 = empty_strided_cuda((1024, 1), (1, 1), torch.int64)
        triton_poi_fused_add_clamp_16[grid(1024)](buf48, 1024, XBLOCK=256,
            num_warps=4, num_stages=1)
        buf49 = empty_strided_cuda((1024,), (1,), torch.int64)
        triton_poi_fused__to_copy_15[grid(1024)](buf49, 1024, XBLOCK=128,
            num_warps=4, num_stages=1)
        buf50 = empty_strided_cuda((1024,), (1,), torch.int64)
        triton_poi_fused_add_clamp_16[grid(1024)](buf50, 1024, XBLOCK=256,
            num_warps=4, num_stages=1)
        buf51 = empty_strided_cuda((1024,), (1,), torch.float32)
        triton_poi_fused__to_copy_add_arange_clamp_mul_sub_17[grid(1024)](buf51
            , 1024, XBLOCK=256, num_warps=4, num_stages=1)
        buf53 = empty_strided_cuda((1024, 1), (1, 1), torch.float32)
        triton_poi_fused__to_copy_add_arange_clamp_mul_sub_17[grid(1024)](buf53
            , 1024, XBLOCK=256, num_warps=4, num_stages=1)
        buf54 = empty_strided_cuda((4, 2, 1024, 1024), (2097152, 1048576, 
            1024, 1), torch.float32)
        buf55 = buf54
        del buf54
        triton_poi_fused__unsafe_index_add_convolution_mul_sub_18[grid(8388608)
            ](buf55, buf47, buf49, buf46, primals_31, buf50, buf51, buf48,
            buf53, 8388608, XBLOCK=1024, num_warps=4, num_stages=1)
        del buf46
        del primals_31
    return (buf55, primals_1, primals_3, primals_4, primals_6, primals_8,
        primals_10, primals_11, primals_13, primals_15, primals_17,
        primals_19, primals_21, primals_22, primals_24, primals_26,
        primals_28, primals_30, buf1, buf3, buf6, buf8, buf10, buf11, buf12,
        buf13, buf16, buf18, buf21, buf23, buf26, buf28, buf30, buf31,
        buf32, buf33, buf36, buf38, buf41, buf43, buf45, buf47, buf48,
        buf49, buf50, buf51, buf53)


class ResBlock(torch.nn.Module):

    def __init__(self, indim, outdim=None, stride=1):
        super(ResBlock, self).__init__()
        if outdim is None:
            outdim = indim
        if indim == outdim and stride == 1:
            self.downsample = None
        else:
            self.downsample = torch.nn.Conv2d(indim, outdim, kernel_size=3,
                padding=1, stride=stride)
        self.conv1 = torch.nn.Conv2d(indim, outdim, kernel_size=3, padding=
            1, stride=stride)
        self.conv2 = torch.nn.Conv2d(outdim, outdim, kernel_size=3, padding=1)

    def forward(self, x):
        r = self.conv1(F.relu(x))
        r = self.conv2(F.relu(r))
        if self.downsample is not None:
            x = self.downsample(x)
        return x + r


class Refine(torch.nn.Module):

    def __init__(self, inplanes, planes, scale_factor=2):
        super(Refine, self).__init__()
        self.convFS = torch.nn.Conv2d(inplanes, planes, kernel_size=3,
            padding=1, stride=1)
        self.ResFS = ResBlock(planes, planes)
        self.ResMM = ResBlock(planes, planes)
        self.scale_factor = scale_factor

    def forward(self, f, pm):
        s = self.ResFS(self.convFS(f))
        m = s + F.interpolate(pm, scale_factor=self.scale_factor, mode=
            'bilinear', align_corners=False)
        m = self.ResMM(m)
        return m


class DecoderNew(torch.nn.Module):

    def __init__(self, mdim):
        super(DecoderNew, self).__init__()
        self.convFM = torch.nn.Conv2d(1024, mdim, kernel_size=3, padding=1,
            stride=1)
        self.ResMM = ResBlock(mdim, mdim)
        self.RF3 = Refine(512, mdim)
        self.RF2 = Refine(256, mdim)
        self.pred2 = torch.nn.Conv2d(mdim, 2, kernel_size=3, padding=1,
            stride=1)

    def forward(self, input_0, input_1, input_2):
        primals_1 = self.convFM.weight
        primals_2 = self.convFM.bias
        primals_4 = self.ResMM.conv1.weight
        primals_5 = self.ResMM.conv1.bias
        primals_6 = self.ResMM.conv2.weight
        primals_7 = self.ResMM.conv2.bias
        primals_8 = self.RF3.convFS.weight
        primals_9 = self.RF3.convFS.bias
        primals_11 = self.RF3.ResFS.conv1.weight
        primals_12 = self.RF3.ResFS.conv1.bias
        primals_13 = self.RF3.ResFS.conv2.weight
        primals_14 = self.RF3.ResFS.conv2.bias
        primals_15 = self.RF3.ResMM.conv1.weight
        primals_16 = self.RF3.ResMM.conv1.bias
        primals_17 = self.RF3.ResMM.conv2.weight
        primals_18 = self.RF3.ResMM.conv2.bias
        primals_19 = self.RF2.convFS.weight
        primals_20 = self.RF2.convFS.bias
        primals_22 = self.RF2.ResFS.conv1.weight
        primals_23 = self.RF2.ResFS.conv1.bias
        primals_24 = self.RF2.ResFS.conv2.weight
        primals_25 = self.RF2.ResFS.conv2.bias
        primals_26 = self.RF2.ResMM.conv1.weight
        primals_27 = self.RF2.ResMM.conv1.bias
        primals_28 = self.RF2.ResMM.conv2.weight
        primals_29 = self.RF2.ResMM.conv2.bias
        primals_30 = self.pred2.weight
        primals_31 = self.pred2.bias
        primals_3 = input_0
        primals_10 = input_1
        primals_21 = input_2
        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, primals_22, primals_23, primals_24,
            primals_25, primals_26, primals_27, primals_28, primals_29,
            primals_30, primals_31])
        return output[0]


Measured latency_ms: 0.056695