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._inductor.runtime.triton_helpers import libdevice
import math
import torch.nn as nn
import torch.nn.functional as F
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__to_copy__unsafe_index_add_arange_clamp_mul_sub_0(
    in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 2 % 2
    x0 = xindex % 2
    x2 = xindex // 4
    x3 = xindex
    tmp0 = x1
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 0.5
    tmp3 = tmp1 + tmp2
    tmp4 = 2.0
    tmp5 = tmp3 * tmp4
    tmp6 = tmp5 - tmp2
    tmp7 = 0.0
    tmp8 = triton_helpers.maximum(tmp6, tmp7)
    tmp9 = tmp8.to(tl.int32)
    tmp10 = x0
    tmp11 = tmp10.to(tl.float32)
    tmp12 = tmp11 + tmp2
    tmp13 = tmp12 * tmp4
    tmp14 = tmp13 - tmp2
    tmp15 = triton_helpers.maximum(tmp14, tmp7)
    tmp16 = tmp15.to(tl.int32)
    tmp17 = tl.load(in_ptr0 + (tmp16 + 4 * tmp9 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp18 = tl.full([1], 1, tl.int64)
    tmp19 = tmp16 + tmp18
    tmp20 = tl.full([1], 3, tl.int64)
    tmp21 = triton_helpers.minimum(tmp19, tmp20)
    tmp22 = tl.load(in_ptr0 + (tmp21 + 4 * tmp9 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp23 = tmp22 - tmp17
    tmp24 = tmp16.to(tl.float32)
    tmp25 = tmp15 - tmp24
    tmp26 = triton_helpers.maximum(tmp25, tmp7)
    tmp27 = 1.0
    tmp28 = triton_helpers.minimum(tmp26, tmp27)
    tmp29 = tmp23 * tmp28
    tmp30 = tmp17 + tmp29
    tmp31 = tmp9 + tmp18
    tmp32 = triton_helpers.minimum(tmp31, tmp20)
    tmp33 = tl.load(in_ptr0 + (tmp21 + 4 * tmp32 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp34 = tl.load(in_ptr0 + (tmp16 + 4 * tmp32 + 16 * x2), xmask,
        eviction_policy='evict_last')
    tmp35 = tmp33 - tmp34
    tmp36 = tmp35 * tmp28
    tmp37 = tmp34 + tmp36
    tmp38 = tmp37 - tmp30
    tmp39 = tmp9.to(tl.float32)
    tmp40 = tmp8 - tmp39
    tmp41 = triton_helpers.maximum(tmp40, tmp7)
    tmp42 = triton_helpers.minimum(tmp41, tmp27)
    tmp43 = tmp38 * tmp42
    tmp44 = tmp30 + tmp43
    tl.store(in_out_ptr0 + x3, tmp44, xmask)


@triton.jit
def triton_poi_fused__to_copy_1(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 = 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_2(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 = 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 = triton_helpers.minimum(tmp10, tmp9)
    tl.store(out_ptr0 + x0, tmp11, xmask)


@triton.jit
def triton_poi_fused__to_copy_add_arange_clamp_mul_sub_3(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 = 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_mul_sub_4(in_out_ptr0, in_ptr0,
    in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5, in_ptr6, in_ptr7, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 4 % 4
    x0 = xindex % 4
    x2 = xindex // 16
    x4 = 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 + x0, xmask, eviction_policy='evict_last')
    tmp16 = tl.load(in_ptr4 + x0, xmask, eviction_policy='evict_last')
    tmp19 = tl.load(in_ptr5 + x4, xmask)
    tmp20 = tl.load(in_ptr6 + x1, xmask, eviction_policy='evict_last')
    tmp30 = tl.load(in_ptr7 + x1, xmask, 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 + 4 * x2), xmask,
        eviction_policy='evict_last')
    tmp11 = tmp10 + tmp1
    tmp12 = tmp10 < 0
    tmp13 = tl.where(tmp12, tmp11, tmp10)
    tmp14 = tl.load(in_ptr2 + (tmp13 + 2 * tmp4 + 4 * x2), xmask,
        eviction_policy='evict_last')
    tmp15 = tmp14 - tmp9
    tmp17 = tmp15 * tmp16
    tmp18 = tmp9 + tmp17
    tmp21 = tmp20 + tmp1
    tmp22 = tmp20 < 0
    tmp23 = tl.where(tmp22, tmp21, tmp20)
    tmp24 = tl.load(in_ptr2 + (tmp8 + 2 * tmp23 + 4 * x2), xmask,
        eviction_policy='evict_last')
    tmp25 = tl.load(in_ptr2 + (tmp13 + 2 * tmp23 + 4 * x2), xmask,
        eviction_policy='evict_last')
    tmp26 = tmp25 - tmp24
    tmp27 = tmp26 * tmp16
    tmp28 = tmp24 + tmp27
    tmp29 = tmp28 - tmp18
    tmp31 = tmp29 * tmp30
    tmp32 = tmp18 + tmp31
    tmp33 = tmp19 - tmp32
    tl.store(in_out_ptr0 + x4, tmp33, xmask)


@triton.jit
def triton_poi_fused_convolution_5(in_out_ptr0, in_ptr0, xnumel, XBLOCK: tl
    .constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x1 = xindex // 4 % 4
    tmp0 = tl.load(in_out_ptr0 + x3, xmask)
    tmp1 = tl.load(in_ptr0 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tl.store(in_out_ptr0 + x3, tmp2, xmask)


@triton.jit
def triton_poi_fused__native_batch_norm_legit_6(in_ptr0, 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
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr0 + (1 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (2 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (3 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tmp6 = tmp4 + tmp5
    tmp7 = 4.0
    tmp8 = tmp6 / tmp7
    tmp9 = tmp0 - tmp8
    tmp10 = tmp9 * tmp9
    tmp11 = tmp1 - tmp8
    tmp12 = tmp11 * tmp11
    tmp13 = tmp10 + tmp12
    tmp14 = tmp3 - tmp8
    tmp15 = tmp14 * tmp14
    tmp16 = tmp13 + tmp15
    tmp17 = tmp5 - tmp8
    tmp18 = tmp17 * tmp17
    tmp19 = tmp16 + tmp18
    tmp20 = tmp19 / tmp7
    tmp21 = 1e-05
    tmp22 = tmp20 + tmp21
    tmp23 = libdevice.rsqrt(tmp22)
    tl.store(out_ptr0 + x0, tmp8, xmask)
    tl.store(out_ptr1 + x0, tmp23, xmask)


@triton.jit
def triton_poi_fused_relu_7(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
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr2 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 - tmp1
    tmp4 = tmp2 * tmp3
    tmp5 = tl.full([1], 0, tl.int32)
    tmp6 = triton_helpers.maximum(tmp5, tmp4)
    tl.store(out_ptr0 + x2, tmp6, xmask)


@triton.jit
def triton_per_fused__native_batch_norm_legit_convolution_relu_8(in_out_ptr0,
    in_ptr0, out_ptr0, out_ptr2, out_ptr3, xnumel, rnumel, XBLOCK: tl.constexpr
    ):
    xnumel = 16
    RBLOCK: tl.constexpr = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    rindex = tl.arange(0, RBLOCK)[None, :]
    tl.full([XBLOCK, RBLOCK], True, tl.int1)
    r2 = rindex
    x3 = xindex
    x0 = xindex % 4
    tmp0 = tl.load(in_out_ptr0 + (r2 + 16 * x3), xmask, other=0.0)
    tmp1 = tl.load(in_ptr0 + x0, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp3 = tl.broadcast_to(tmp2, [XBLOCK, RBLOCK])
    tl.where(xmask, tmp3, 0)
    tmp6 = tl.broadcast_to(tmp3, [XBLOCK, RBLOCK])
    tmp8 = tl.where(xmask, tmp6, 0)
    tmp9 = tl.sum(tmp8, 1)[:, None]
    tmp10 = tl.full([XBLOCK, 1], 16, tl.int32)
    tmp11 = tmp10.to(tl.float32)
    tmp12 = tmp9 / tmp11
    tmp13 = tmp3 - tmp12
    tmp14 = tmp13 * tmp13
    tmp15 = tl.broadcast_to(tmp14, [XBLOCK, RBLOCK])
    tmp17 = tl.where(xmask, tmp15, 0)
    tmp18 = tl.sum(tmp17, 1)[:, None]
    tmp19 = tmp2 - tmp12
    tmp20 = 16.0
    tmp21 = tmp18 / tmp20
    tmp22 = 1e-05
    tmp23 = tmp21 + tmp22
    tmp24 = libdevice.rsqrt(tmp23)
    tmp25 = tmp19 * tmp24
    tmp26 = tl.full([1, 1], 0, tl.int32)
    tmp27 = triton_helpers.maximum(tmp26, tmp25)
    tl.store(in_out_ptr0 + (r2 + 16 * x3), tmp2, xmask)
    tl.store(out_ptr2 + (r2 + 16 * x3), tmp27, xmask)
    tl.store(out_ptr3 + x3, tmp24, xmask)
    tl.store(out_ptr0 + x3, tmp12, xmask)


@triton.jit
def triton_per_fused__native_batch_norm_legit__unsafe_index_add_convolution_mul_relu_sub_threshold_backward_9(
    in_out_ptr0, in_out_ptr2, in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4,
    in_ptr5, in_ptr6, in_ptr7, in_ptr8, in_ptr9, out_ptr0, out_ptr1,
    out_ptr2, out_ptr4, out_ptr5, xnumel, rnumel, XBLOCK: tl.constexpr):
    xnumel = 16
    RBLOCK: tl.constexpr = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    rindex = tl.arange(0, RBLOCK)[None, :]
    tl.full([XBLOCK, RBLOCK], True, tl.int1)
    x0 = xindex
    r3 = rindex
    x1 = xindex % 4
    r5 = rindex // 4
    r4 = rindex % 4
    tmp0 = tl.load(in_ptr0 + 4 * x0, xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr0 + (1 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr0 + (2 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (3 + 4 * x0), xmask, eviction_policy='evict_last')
    tmp24 = tl.load(in_out_ptr0 + (r3 + 16 * x0), xmask, other=0.0)
    tmp25 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp43 = tl.load(in_ptr2 + r5, None, eviction_policy='evict_last')
    tmp48 = tl.load(in_ptr3 + r4, None, eviction_policy='evict_last')
    tmp59 = tl.load(in_ptr5 + r5, None, eviction_policy='evict_last')
    tmp69 = tl.load(in_ptr6 + r4, None, eviction_policy='evict_last')
    tmp80 = tl.load(in_ptr7 + r4, None, eviction_policy='evict_last')
    tmp93 = tl.load(in_ptr8 + r5, None, eviction_policy='evict_last')
    tmp102 = tl.load(in_ptr9 + (r3 + 16 * x0), xmask, other=0.0)
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tmp6 = tmp4 + tmp5
    tmp7 = 4.0
    tmp8 = tmp6 / tmp7
    tmp9 = tmp0 - tmp8
    tmp10 = tmp9 * tmp9
    tmp11 = tmp1 - tmp8
    tmp12 = tmp11 * tmp11
    tmp13 = tmp10 + tmp12
    tmp14 = tmp3 - tmp8
    tmp15 = tmp14 * tmp14
    tmp16 = tmp13 + tmp15
    tmp17 = tmp5 - tmp8
    tmp18 = tmp17 * tmp17
    tmp19 = tmp16 + tmp18
    tmp20 = tmp19 / tmp7
    tmp21 = 1e-05
    tmp22 = tmp20 + tmp21
    tmp23 = libdevice.rsqrt(tmp22)
    tmp26 = tmp24 + tmp25
    tmp27 = tl.broadcast_to(tmp26, [XBLOCK, RBLOCK])
    tl.where(xmask, tmp27, 0)
    tmp30 = tl.broadcast_to(tmp27, [XBLOCK, RBLOCK])
    tmp32 = tl.where(xmask, tmp30, 0)
    tmp33 = tl.sum(tmp32, 1)[:, None]
    tmp34 = tl.full([XBLOCK, 1], 16, tl.int32)
    tmp35 = tmp34.to(tl.float32)
    tmp36 = tmp33 / tmp35
    tmp37 = tmp27 - tmp36
    tmp38 = tmp37 * tmp37
    tmp39 = tl.broadcast_to(tmp38, [XBLOCK, RBLOCK])
    tmp41 = tl.where(xmask, tmp39, 0)
    tmp42 = tl.sum(tmp41, 1)[:, None]
    tmp44 = tl.full([XBLOCK, RBLOCK], 2, tl.int32)
    tmp45 = tmp43 + tmp44
    tmp46 = tmp43 < 0
    tmp47 = tl.where(tmp46, tmp45, tmp43)
    tmp49 = tmp48 + tmp44
    tmp50 = tmp48 < 0
    tmp51 = tl.where(tmp50, tmp49, tmp48)
    tmp52 = tl.load(in_ptr0 + (tmp51 + 2 * tmp47 + 4 * x0), xmask,
        eviction_policy='evict_last')
    tmp53 = tmp52 - tmp8
    tmp54 = tmp53 * tmp23
    tmp55 = tl.load(in_ptr4 + (tmp51 + 2 * tmp47 + 4 * x0), xmask,
        eviction_policy='evict_last')
    tmp56 = tmp54 + tmp55
    tmp57 = tl.full([1, 1], 0, tl.int32)
    tmp58 = triton_helpers.maximum(tmp57, tmp56)
    tmp60 = tmp59 + tmp44
    tmp61 = tmp59 < 0
    tmp62 = tl.where(tmp61, tmp60, tmp59)
    tmp63 = tl.load(in_ptr0 + (tmp51 + 2 * tmp62 + 4 * x0), xmask,
        eviction_policy='evict_last')
    tmp64 = tmp63 - tmp8
    tmp65 = tmp64 * tmp23
    tmp66 = tl.load(in_ptr4 + (tmp51 + 2 * tmp62 + 4 * x0), xmask,
        eviction_policy='evict_last')
    tmp67 = tmp65 + tmp66
    tmp68 = triton_helpers.maximum(tmp57, tmp67)
    tmp70 = tmp69 + tmp44
    tmp71 = tmp69 < 0
    tmp72 = tl.where(tmp71, tmp70, tmp69)
    tmp73 = tl.load(in_ptr0 + (tmp72 + 2 * tmp62 + 4 * x0), xmask,
        eviction_policy='evict_last')
    tmp74 = tmp73 - tmp8
    tmp75 = tmp74 * tmp23
    tmp76 = tl.load(in_ptr4 + (tmp72 + 2 * tmp62 + 4 * x0), xmask,
        eviction_policy='evict_last')
    tmp77 = tmp75 + tmp76
    tmp78 = triton_helpers.maximum(tmp57, tmp77)
    tmp79 = tmp78 - tmp68
    tmp81 = tmp79 * tmp80
    tmp82 = tmp68 + tmp81
    tmp83 = tl.load(in_ptr0 + (tmp72 + 2 * tmp47 + 4 * x0), xmask,
        eviction_policy='evict_last')
    tmp84 = tmp83 - tmp8
    tmp85 = tmp84 * tmp23
    tmp86 = tl.load(in_ptr4 + (tmp72 + 2 * tmp47 + 4 * x0), xmask,
        eviction_policy='evict_last')
    tmp87 = tmp85 + tmp86
    tmp88 = triton_helpers.maximum(tmp57, tmp87)
    tmp89 = tmp88 - tmp58
    tmp90 = tmp89 * tmp80
    tmp91 = tmp58 + tmp90
    tmp92 = tmp91 - tmp82
    tmp94 = tmp92 * tmp93
    tmp95 = tmp82 + tmp94
    tmp96 = tmp26 - tmp36
    tmp97 = 16.0
    tmp98 = tmp42 / tmp97
    tmp99 = tmp98 + tmp21
    tmp100 = libdevice.rsqrt(tmp99)
    tmp101 = tmp96 * tmp100
    tmp103 = tmp101 + tmp102
    tmp104 = triton_helpers.maximum(tmp57, tmp103)
    tmp105 = tmp95 + tmp104
    tmp106 = 0.0
    tmp107 = tmp104 <= tmp106
    tl.store(out_ptr0 + x0, tmp8, xmask)
    tl.store(out_ptr1 + x0, tmp23, xmask)
    tl.store(in_out_ptr0 + (r3 + 16 * x0), tmp26, xmask)
    tl.store(in_out_ptr2 + (r3 + 16 * x0), tmp105, xmask)
    tl.store(out_ptr4 + (r3 + 16 * x0), tmp107, xmask)
    tl.store(out_ptr5 + x0, tmp100, xmask)
    tl.store(out_ptr2 + x0, tmp36, xmask)


@triton.jit
def triton_poi_fused_add_relu_threshold_backward_10(in_ptr0, in_ptr1,
    in_ptr2, in_ptr3, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x1 = xindex // 4
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp3 = tl.load(in_ptr2 + x1, xmask, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr3 + x2, xmask)
    tmp2 = tmp0 - tmp1
    tmp4 = tmp2 * tmp3
    tmp6 = tmp4 + tmp5
    tmp7 = tl.full([1], 0, tl.int32)
    tmp8 = triton_helpers.maximum(tmp7, tmp6)
    tmp9 = 0.0
    tmp10 = tmp8 <= tmp9
    tl.store(out_ptr0 + x2, tmp10, xmask)


def call(args):
    (primals_1, primals_2, primals_3, primals_4, primals_5, primals_6,
        primals_7, primals_8, primals_9) = args
    args.clear()
    assert_size_stride(primals_1, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(primals_2, (4, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_3, (4,), (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, 4, 3, 3), (36, 9, 3, 1))
    assert_size_stride(primals_9, (4,), (1,))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf1 = empty_strided_cuda((4, 4, 2, 2), (16, 4, 2, 1), torch.float32)
        buf2 = buf1
        del buf1
        buf3 = buf2
        del buf2
        get_raw_stream(0)
        triton_poi_fused__to_copy__unsafe_index_add_arange_clamp_mul_sub_0[grid
            (64)](buf3, primals_1, 64, XBLOCK=64, num_warps=1, num_stages=1)
        buf4 = empty_strided_cuda((4, 1), (1, 1), torch.int64)
        triton_poi_fused__to_copy_1[grid(4)](buf4, 4, XBLOCK=4, num_warps=1,
            num_stages=1)
        buf5 = empty_strided_cuda((4, 1), (1, 1), torch.int64)
        triton_poi_fused_add_clamp_2[grid(4)](buf5, 4, XBLOCK=4, num_warps=
            1, num_stages=1)
        buf6 = empty_strided_cuda((4,), (1,), torch.int64)
        triton_poi_fused__to_copy_1[grid(4)](buf6, 4, XBLOCK=4, num_warps=1,
            num_stages=1)
        buf7 = empty_strided_cuda((4,), (1,), torch.int64)
        triton_poi_fused_add_clamp_2[grid(4)](buf7, 4, XBLOCK=4, num_warps=
            1, num_stages=1)
        buf8 = empty_strided_cuda((4,), (1,), torch.float32)
        triton_poi_fused__to_copy_add_arange_clamp_mul_sub_3[grid(4)](buf8,
            4, XBLOCK=4, num_warps=1, num_stages=1)
        buf10 = empty_strided_cuda((4, 1), (1, 1), torch.float32)
        triton_poi_fused__to_copy_add_arange_clamp_mul_sub_3[grid(4)](buf10,
            4, XBLOCK=4, num_warps=1, num_stages=1)
        buf9 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf11 = buf9
        del buf9
        triton_poi_fused__unsafe_index_add_mul_sub_4[grid(256)](buf11, buf4,
            buf6, buf3, buf7, buf8, primals_1, buf5, buf10, 256, XBLOCK=256,
            num_warps=4, num_stages=1)
        del primals_1
        buf12 = extern_kernels.convolution(buf3, primals_2, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf12, (4, 4, 2, 2), (16, 4, 2, 1))
        buf13 = buf12
        del buf12
        triton_poi_fused_convolution_5[grid(64)](buf13, primals_3, 64,
            XBLOCK=64, num_warps=1, num_stages=1)
        del primals_3
        buf14 = empty_strided_cuda((1, 16, 1, 1), (16, 1, 16, 16), torch.
            float32)
        buf15 = empty_strided_cuda((1, 16, 1, 1), (16, 1, 16, 16), torch.
            float32)
        triton_poi_fused__native_batch_norm_legit_6[grid(16)](buf13, buf14,
            buf15, 16, XBLOCK=16, num_warps=1, num_stages=1)
        buf16 = empty_strided_cuda((4, 4, 2, 2), (16, 4, 2, 1), torch.float32)
        triton_poi_fused_relu_7[grid(64)](buf13, buf14, buf15, buf16, 64,
            XBLOCK=64, num_warps=1, num_stages=1)
        buf17 = extern_kernels.convolution(buf16, primals_4, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf17, (4, 4, 2, 2), (16, 4, 2, 1))
        buf18 = buf17
        del buf17
        triton_poi_fused_convolution_5[grid(64)](buf18, primals_5, 64,
            XBLOCK=64, num_warps=1, num_stages=1)
        del primals_5
        buf21 = extern_kernels.convolution(buf11, primals_6, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf21, (4, 4, 4, 4), (64, 16, 4, 1))
        buf22 = buf21
        del buf21
        buf23 = buf15
        del buf15
        buf27 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf26 = buf14
        del buf14
        triton_per_fused__native_batch_norm_legit_convolution_relu_8[grid(16)](
            buf22, primals_7, buf23, buf27, buf26, 16, 16, XBLOCK=1,
            num_warps=2, num_stages=1)
        del primals_7
        buf28 = extern_kernels.convolution(buf27, primals_8, stride=(1, 1),
            padding=(1, 1), dilation=(1, 1), transposed=False,
            output_padding=(0, 0), groups=1, bias=None)
        assert_size_stride(buf28, (4, 4, 4, 4), (64, 16, 4, 1))
        buf19 = empty_strided_cuda((1, 16, 1, 1), (16, 1, 16, 16), torch.
            float32)
        buf20 = empty_strided_cuda((1, 16, 1, 1), (16, 1, 16, 16), torch.
            float32)
        buf29 = buf28
        del buf28
        buf30 = empty_strided_cuda((1, 16, 1, 1), (16, 1, 16, 16), torch.
            float32)
        buf35 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf37 = buf35
        del buf35
        buf38 = buf37
        del buf37
        buf39 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.bool)
        buf33 = empty_strided_cuda((1, 16, 1, 1), (16, 1, 16, 16), torch.
            float32)
        triton_per_fused__native_batch_norm_legit__unsafe_index_add_convolution_mul_relu_sub_threshold_backward_9[
            grid(16)](buf29, buf38, buf18, primals_9, buf5, buf6, buf3,
            buf4, buf7, buf8, buf10, buf11, buf19, buf20, buf30, buf39,
            buf33, 16, 16, XBLOCK=8, num_warps=2, num_stages=1)
        del primals_9
        buf40 = empty_strided_cuda((4, 4, 2, 2), (16, 4, 2, 1), torch.bool)
        triton_poi_fused_add_relu_threshold_backward_10[grid(64)](buf18,
            buf19, buf20, buf3, buf40, 64, XBLOCK=64, num_warps=1, num_stages=1
            )
        del buf19
        del buf20
    return (buf38, primals_2, primals_4, primals_6, primals_8, buf3, buf4,
        buf5, buf6, buf7, buf8, buf10, buf11, buf13, buf16, buf18, buf22,
        reinterpret_tensor(buf26, (16,), (1,), 0), buf27, buf29,
        reinterpret_tensor(buf33, (16,), (1,), 0), buf39,
        reinterpret_tensor(buf30, (1, 16, 1, 1), (16, 1, 1, 1), 0),
        reinterpret_tensor(buf23, (1, 16, 1, 1), (16, 1, 1, 1), 0), buf40)


class resBlock(nn.Module):

    def __init__(self, channelDepth, windowSize=3):
        super(resBlock, self).__init__()
        padding = math.floor(windowSize / 2)
        self.conv1 = nn.Conv2d(channelDepth, channelDepth, windowSize, 1,
            padding)
        self.conv2 = nn.Conv2d(channelDepth, channelDepth, windowSize, 1,
            padding)
        self.IN_conv = nn.InstanceNorm2d(channelDepth, track_running_stats=
            False, affine=False)

    def forward(self, x):
        res = x
        x = F.relu(self.IN_conv(self.conv1(x)))
        x = self.IN_conv(self.conv2(x))
        x = F.relu(x + res)
        return x


class lrBLock_l2New(nn.Module):

    def __init__(self, channelDepth, windowSize=3):
        super(lrBLock_l2New, self).__init__()
        math.floor(windowSize / 2)
        self.res_l2 = resBlock(channelDepth, windowSize)
        self.res_l1 = resBlock(channelDepth, windowSize)

    def forward(self, input_0):
        primals_2 = self.res_l2.conv1.weight
        primals_3 = self.res_l2.conv1.bias
        primals_4 = self.res_l2.conv2.weight
        primals_5 = self.res_l2.conv2.bias
        primals_6 = self.res_l1.conv1.weight
        primals_7 = self.res_l1.conv1.bias
        primals_8 = self.res_l1.conv2.weight
        primals_9 = self.res_l1.conv2.bias
        primals_1 = input_0
        output = call([primals_1, primals_2, primals_3, primals_4,
            primals_5, primals_6, primals_7, primals_8, primals_9])
        return output[0]


Measured latency_ms: 0.059145