import torch
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 torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
from torchvision.transforms import functional as F
from torch.nn import functional as F
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda


@triton.jit
def triton_per_fused_mean_std_0(in_ptr0, out_ptr0, out_ptr1, xnumel, rnumel,
    XBLOCK: tl.constexpr):
    xnumel = 4
    RBLOCK: tl.constexpr = 64
    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)
    r1 = rindex
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (r1 + 64 * x0), xmask, other=0.0)
    tmp1 = tl.broadcast_to(tmp0, [XBLOCK, RBLOCK])
    tmp3 = tl.where(xmask, tmp1, 0)
    tmp4 = tl.broadcast_to(tmp1, [XBLOCK, RBLOCK])
    tmp6 = tl.where(xmask, tmp4, 0)
    tmp7 = tl.sum(tmp6, 1)[:, None]
    tmp8 = tl.full([XBLOCK, 1], 64, tl.int32)
    tmp9 = tmp8.to(tl.float32)
    tmp10 = tmp7 / tmp9
    tmp11 = tmp1 - tmp10
    tmp12 = tmp11 * tmp11
    tmp13 = tl.broadcast_to(tmp12, [XBLOCK, RBLOCK])
    tmp15 = tl.where(xmask, tmp13, 0)
    tmp16 = tl.sum(tmp15, 1)[:, None]
    tmp18 = tl.sum(tmp3, 1)[:, None]
    tl.store(out_ptr0 + x0, tmp16, xmask)
    tl.store(out_ptr1 + x0, tmp18, xmask)


@triton.jit
def _triton_helper_fn_add0(arg0_0, arg1_0):
    tmp0 = arg0_0 + arg1_0
    return tmp0


@triton.jit
def triton_per_fused_add_constant_pad_nd_cumsum_div_mean_pow_std_sub_1(in_ptr0,
    in_ptr1, in_ptr2, out_ptr0, out_ptr1, xnumel, rnumel, XBLOCK: tl.constexpr
    ):
    xnumel = 80
    rnumel = 5
    RBLOCK: tl.constexpr = 8
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    rindex = tl.arange(0, RBLOCK)[None, :]
    rmask = rindex < rnumel
    r3 = rindex
    x0 = xindex % 5
    x5 = xindex // 5
    x2 = xindex // 20
    tmp0 = -1 + r3
    tmp1 = tl.full([1, 1], 0, tl.int64)
    tmp2 = tmp0 >= tmp1
    tmp3 = -1 + x0
    tmp4 = tmp3 >= tmp1
    tmp5 = tmp2 & tmp4
    tmp6 = tl.load(in_ptr0 + (-5 + x0 + 4 * r3 + 16 * x5), rmask & tmp5 &
        xmask, other=0.0)
    tmp7 = tl.load(in_ptr1 + tl.broadcast_to(x2, [XBLOCK, RBLOCK]), rmask &
        tmp5 & xmask, eviction_policy='evict_last', other=0.0)
    tmp8 = 63.0
    tmp9 = tmp7 / tmp8
    tmp10 = libdevice.sqrt(tmp9)
    tmp11 = 0.001
    tmp12 = tmp10 + tmp11
    tmp13 = tmp6 / tmp12
    tmp14 = tl.load(in_ptr2 + tl.broadcast_to(x2, [XBLOCK, RBLOCK]), rmask &
        tmp5 & xmask, eviction_policy='evict_last', other=0.0)
    tmp15 = 64.0
    tmp16 = tmp14 / tmp15
    tmp17 = tmp16 / tmp12
    tmp18 = tmp13 - tmp17
    tmp19 = tmp18 * tmp18
    tmp20 = tl.full(tmp19.shape, 0.0, tmp19.dtype)
    tmp21 = tl.where(tmp5, tmp19, tmp20)
    tmp22 = tmp21.to(tl.float32)
    tmp23 = tl.broadcast_to(tmp22, [XBLOCK, RBLOCK])
    tmp24, = tl.associative_scan((tmp23,), 1, _triton_helper_fn_add0)
    tmp25 = tl.full(tmp18.shape, 0.0, tmp18.dtype)
    tmp26 = tl.where(tmp5, tmp18, tmp25)
    tmp27 = tmp26.to(tl.float32)
    tmp28 = tl.broadcast_to(tmp27, [XBLOCK, RBLOCK])
    tmp29, = tl.associative_scan((tmp28,), 1, _triton_helper_fn_add0)
    tl.store(out_ptr0 + (x0 + 5 * r3 + 25 * x5), tmp24, rmask & xmask)
    tl.store(out_ptr1 + (x0 + 5 * r3 + 25 * x5), tmp29, rmask & xmask)


@triton.jit
def _triton_helper_fn_add0(arg0_0, arg1_0):
    tmp0 = arg0_0 + arg1_0
    return tmp0


@triton.jit
def triton_per_fused_cumsum_sub_2(in_ptr0, out_ptr0, xnumel, rnumel, XBLOCK:
    tl.constexpr):
    xnumel = 64
    rnumel = 5
    RBLOCK: tl.constexpr = 8
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    rindex = tl.arange(0, RBLOCK)[None, :]
    rmask = rindex < rnumel
    r2 = rindex
    x0 = xindex % 4
    x1 = xindex // 4
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (5 + r2 + 5 * x0 + 25 * x1), rmask & xmask,
        other=0.0)
    tmp1 = tl.load(in_ptr0 + (r2 + 5 * x0 + 25 * x1), rmask & xmask, other=0.0)
    tmp2 = tmp0 - tmp1
    tmp3 = tmp2.to(tl.float32)
    tmp4 = tl.broadcast_to(tmp3, [XBLOCK, RBLOCK])
    tmp5, = tl.associative_scan((tmp4,), 1, _triton_helper_fn_add0)
    tl.store(out_ptr0 + (r2 + 5 * x3), tmp5, rmask & xmask)


@triton.jit
def _triton_helper_fn_add0(arg0_0, arg1_0):
    tmp0 = arg0_0 + arg1_0
    return tmp0


@triton.jit
def triton_per_fused_constant_pad_nd_cumsum_ones_3(out_ptr0, xnumel, rnumel,
    XBLOCK: tl.constexpr):
    xnumel = 5
    rnumel = 5
    RBLOCK: tl.constexpr = 8
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    rindex = tl.arange(0, RBLOCK)[None, :]
    rmask = rindex < rnumel
    r1 = rindex
    x0 = xindex
    tmp0 = -1 + r1
    tmp1 = tl.full([1, 1], 0, tl.int64)
    tmp2 = tmp0 >= tmp1
    tmp3 = -1 + x0
    tmp4 = tmp3 >= tmp1
    tmp5 = tmp2 & tmp4
    tmp6 = 1.0
    tmp7 = tl.full(tmp6.shape, 0.0, tmp6.dtype)
    tmp8 = tl.where(tmp5, tmp6, tmp7)
    tmp9 = tmp8.to(tl.float32)
    tmp10 = tl.broadcast_to(tmp9, [XBLOCK, RBLOCK])
    tmp11, = tl.associative_scan((tmp10,), 1, _triton_helper_fn_add0)
    tl.store(out_ptr0 + (x0 + 5 * r1), tmp11, rmask & xmask)


@triton.jit
def _triton_helper_fn_add0(arg0_0, arg1_0):
    tmp0 = arg0_0 + arg1_0
    return tmp0


@triton.jit
def triton_per_fused_cumsum_sub_4(in_ptr0, out_ptr0, xnumel, rnumel, XBLOCK:
    tl.constexpr):
    xnumel = 4
    rnumel = 5
    RBLOCK: tl.constexpr = 8
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    rindex = tl.arange(0, RBLOCK)[None, :]
    rmask = rindex < rnumel
    r1 = rindex
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (5 + r1 + 5 * x0), rmask & xmask, other=0.0)
    tmp1 = tl.load(in_ptr0 + (r1 + 5 * x0), rmask & xmask, other=0.0)
    tmp2 = tmp0 - tmp1
    tmp3 = tmp2.to(tl.float32)
    tmp4 = tl.broadcast_to(tmp3, [XBLOCK, RBLOCK])
    tmp5, = tl.associative_scan((tmp4,), 1, _triton_helper_fn_add0)
    tl.store(out_ptr0 + (r1 + 5 * x0), tmp5, rmask & xmask)


@triton.jit
def triton_poi_fused_div_mean_sub_5(in_ptr0, in_ptr1, in_ptr2, out_ptr0,
    out_ptr1, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 4
    x1 = xindex // 4 % 4
    x2 = xindex // 16
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (1 + x0 + 5 * x1 + 80 * x2), xmask)
    tmp1 = tl.load(in_ptr0 + (x0 + 5 * x1 + 80 * x2), xmask)
    tmp3 = tl.load(in_ptr0 + (21 + x0 + 5 * x1 + 80 * x2), xmask)
    tmp4 = tl.load(in_ptr0 + (20 + x0 + 5 * x1 + 80 * x2), xmask)
    tmp7 = tl.load(in_ptr0 + (41 + x0 + 5 * x1 + 80 * x2), xmask)
    tmp8 = tl.load(in_ptr0 + (40 + x0 + 5 * x1 + 80 * x2), xmask)
    tmp11 = tl.load(in_ptr0 + (61 + x0 + 5 * x1 + 80 * x2), xmask)
    tmp12 = tl.load(in_ptr0 + (60 + x0 + 5 * x1 + 80 * x2), xmask)
    tmp17 = tl.load(in_ptr1 + (1 + x0 + 5 * x1), xmask, eviction_policy=
        'evict_last')
    tmp18 = tl.load(in_ptr1 + (x0 + 5 * x1), xmask, eviction_policy=
        'evict_last')
    tmp21 = tl.load(in_ptr2 + (1 + x0 + 5 * x1 + 80 * x2), xmask)
    tmp22 = tl.load(in_ptr2 + (x0 + 5 * x1 + 80 * x2), xmask)
    tmp24 = tl.load(in_ptr2 + (21 + x0 + 5 * x1 + 80 * x2), xmask)
    tmp25 = tl.load(in_ptr2 + (20 + x0 + 5 * x1 + 80 * x2), xmask)
    tmp28 = tl.load(in_ptr2 + (41 + x0 + 5 * x1 + 80 * x2), xmask)
    tmp29 = tl.load(in_ptr2 + (40 + x0 + 5 * x1 + 80 * x2), xmask)
    tmp32 = tl.load(in_ptr2 + (61 + x0 + 5 * x1 + 80 * x2), xmask)
    tmp33 = tl.load(in_ptr2 + (60 + x0 + 5 * x1 + 80 * x2), xmask)
    tmp2 = tmp0 - tmp1
    tmp5 = tmp3 - tmp4
    tmp6 = tmp2 + tmp5
    tmp9 = tmp7 - tmp8
    tmp10 = tmp6 + tmp9
    tmp13 = tmp11 - tmp12
    tmp14 = tmp10 + tmp13
    tmp15 = 4.0
    tmp16 = tmp14 / tmp15
    tmp19 = tmp17 - tmp18
    tmp20 = tmp16 / tmp19
    tmp23 = tmp21 - tmp22
    tmp26 = tmp24 - tmp25
    tmp27 = tmp23 + tmp26
    tmp30 = tmp28 - tmp29
    tmp31 = tmp27 + tmp30
    tmp34 = tmp32 - tmp33
    tmp35 = tmp31 + tmp34
    tmp36 = tmp35 / tmp15
    tmp37 = tmp36 / tmp19
    tl.store(out_ptr0 + x3, tmp20, xmask)
    tl.store(out_ptr1 + x3, tmp37, xmask)


@triton.jit
def _triton_helper_fn_add0(arg0_0, arg1_0):
    tmp0 = arg0_0 + arg1_0
    return tmp0


@triton.jit
def triton_per_fused_add_clamp_constant_pad_nd_cumsum_div_mul_neg_pow_reciprocal_sqrt_sub_6(
    in_ptr0, in_ptr1, out_ptr0, out_ptr1, xnumel, rnumel, XBLOCK: tl.constexpr
    ):
    xnumel = 20
    rnumel = 5
    RBLOCK: tl.constexpr = 8
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    rindex = tl.arange(0, RBLOCK)[None, :]
    rmask = rindex < rnumel
    r2 = rindex
    x0 = xindex % 5
    x1 = xindex // 5
    tmp0 = -1 + r2
    tmp1 = tl.full([1, 1], 0, tl.int64)
    tmp2 = tmp0 >= tmp1
    tmp3 = -1 + x0
    tmp4 = tmp3 >= tmp1
    tmp5 = tmp2 & tmp4
    tmp6 = tl.load(in_ptr0 + (-5 + x0 + 4 * r2 + 16 * x1), rmask & tmp5 &
        xmask, other=0.0)
    tmp7 = tl.load(in_ptr1 + (-5 + x0 + 4 * r2 + 16 * x1), rmask & tmp5 &
        xmask, other=0.0)
    tmp8 = tmp7 * tmp7
    tmp9 = tmp6 - tmp8
    tmp10 = 0.0
    tmp11 = triton_helpers.maximum(tmp9, tmp10)
    tmp12 = 0.001
    tmp13 = tmp11 + tmp12
    tmp14 = libdevice.sqrt(tmp13)
    tmp15 = tl.full([1, 1], 1, tl.int32)
    tmp16 = tmp15 / tmp14
    tmp17 = 1.0
    tmp18 = tmp16 * tmp17
    tmp19 = tl.full(tmp18.shape, 0.0, tmp18.dtype)
    tmp20 = tl.where(tmp5, tmp18, tmp19)
    tmp21 = tmp20.to(tl.float32)
    tmp22 = tl.broadcast_to(tmp21, [XBLOCK, RBLOCK])
    tmp23, = tl.associative_scan((tmp22,), 1, _triton_helper_fn_add0)
    tmp24 = -tmp7
    tmp25 = tmp24 / tmp14
    tmp26 = tl.full(tmp25.shape, 0.0, tmp25.dtype)
    tmp27 = tl.where(tmp5, tmp25, tmp26)
    tmp28 = tmp27.to(tl.float32)
    tmp29 = tl.broadcast_to(tmp28, [XBLOCK, RBLOCK])
    tmp30, = tl.associative_scan((tmp29,), 1, _triton_helper_fn_add0)
    tl.store(out_ptr0 + (x0 + 5 * r2 + 25 * x1), tmp23, rmask & xmask)
    tl.store(out_ptr1 + (x0 + 5 * r2 + 25 * x1), tmp30, rmask & xmask)


@triton.jit
def _triton_helper_fn_add0(arg0_0, arg1_0):
    tmp0 = arg0_0 + arg1_0
    return tmp0


@triton.jit
def triton_per_fused_cumsum_sub_7(in_ptr0, out_ptr0, xnumel, rnumel, XBLOCK:
    tl.constexpr):
    xnumel = 16
    rnumel = 5
    RBLOCK: tl.constexpr = 8
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = xindex < xnumel
    rindex = tl.arange(0, RBLOCK)[None, :]
    rmask = rindex < rnumel
    r2 = rindex
    x0 = xindex % 4
    x1 = xindex // 4
    x3 = xindex
    tmp0 = tl.load(in_ptr0 + (5 + r2 + 5 * x0 + 25 * x1), rmask & xmask,
        other=0.0)
    tmp1 = tl.load(in_ptr0 + (r2 + 5 * x0 + 25 * x1), rmask & xmask, other=0.0)
    tmp2 = tmp0 - tmp1
    tmp3 = tmp2.to(tl.float32)
    tmp4 = tl.broadcast_to(tmp3, [XBLOCK, RBLOCK])
    tmp5, = tl.associative_scan((tmp4,), 1, _triton_helper_fn_add0)
    tl.store(out_ptr0 + (r2 + 5 * x3), tmp5, rmask & xmask)


@triton.jit
def triton_poi_fused__to_copy__unsafe_index_add_arange_clamp_div_mul_sub_8(
    in_out_ptr0, in_out_ptr1, in_out_ptr2, in_out_ptr3, in_ptr0, in_ptr1,
    in_ptr2, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    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 = x1
    tmp1 = tmp0.to(tl.float32)
    tmp2 = 0.5
    tmp3 = tmp1 + tmp2
    tmp4 = 1.0
    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], 3, tl.int64)
    tmp13 = triton_helpers.minimum(tmp11, tmp12)
    tmp14 = x0
    tmp15 = tmp14.to(tl.float32)
    tmp16 = tmp15 + tmp2
    tmp17 = tmp16 * tmp4
    tmp18 = tmp17 - tmp2
    tmp19 = triton_helpers.maximum(tmp18, tmp7)
    tmp20 = tmp19.to(tl.int32)
    tmp21 = tmp20 + tmp10
    tmp22 = triton_helpers.minimum(tmp21, tmp12)
    tmp23 = tl.load(in_ptr0 + (1 + tmp22 + 5 * tmp13 + 20 * x2), xmask,
        eviction_policy='evict_last')
    tmp24 = tl.load(in_ptr0 + (tmp22 + 5 * tmp13 + 20 * x2), xmask,
        eviction_policy='evict_last')
    tmp25 = tmp23 - tmp24
    tmp26 = tl.load(in_ptr1 + (1 + tmp22 + 5 * tmp13), xmask,
        eviction_policy='evict_last')
    tmp27 = tl.load(in_ptr1 + (tmp22 + 5 * tmp13), xmask, eviction_policy=
        'evict_last')
    tmp28 = tmp26 - tmp27
    tmp29 = tmp25 / tmp28
    tmp30 = tl.load(in_ptr0 + (1 + tmp20 + 5 * tmp13 + 20 * x2), xmask,
        eviction_policy='evict_last')
    tmp31 = tl.load(in_ptr0 + (tmp20 + 5 * tmp13 + 20 * x2), xmask,
        eviction_policy='evict_last')
    tmp32 = tmp30 - tmp31
    tmp33 = tl.load(in_ptr1 + (1 + tmp20 + 5 * tmp13), xmask,
        eviction_policy='evict_last')
    tmp34 = tl.load(in_ptr1 + (tmp20 + 5 * tmp13), xmask, eviction_policy=
        'evict_last')
    tmp35 = tmp33 - tmp34
    tmp36 = tmp32 / tmp35
    tmp37 = tmp29 - tmp36
    tmp38 = tl.load(in_ptr0 + (1 + tmp22 + 5 * tmp9 + 20 * x2), xmask,
        eviction_policy='evict_last')
    tmp39 = tl.load(in_ptr0 + (tmp22 + 5 * tmp9 + 20 * x2), xmask,
        eviction_policy='evict_last')
    tmp40 = tmp38 - tmp39
    tmp41 = tl.load(in_ptr1 + (1 + tmp22 + 5 * tmp9), xmask,
        eviction_policy='evict_last')
    tmp42 = tl.load(in_ptr1 + (tmp22 + 5 * tmp9), xmask, eviction_policy=
        'evict_last')
    tmp43 = tmp41 - tmp42
    tmp44 = tmp40 / tmp43
    tmp45 = tl.load(in_ptr0 + (1 + tmp20 + 5 * tmp9 + 20 * x2), xmask,
        eviction_policy='evict_last')
    tmp46 = tl.load(in_ptr0 + (tmp20 + 5 * tmp9 + 20 * x2), xmask,
        eviction_policy='evict_last')
    tmp47 = tmp45 - tmp46
    tmp48 = tl.load(in_ptr1 + (1 + tmp20 + 5 * tmp9), xmask,
        eviction_policy='evict_last')
    tmp49 = tl.load(in_ptr1 + (tmp20 + 5 * tmp9), xmask, eviction_policy=
        'evict_last')
    tmp50 = tmp48 - tmp49
    tmp51 = tmp47 / tmp50
    tmp52 = tmp44 - tmp51
    tmp53 = tmp20.to(tl.float32)
    tmp54 = tmp19 - tmp53
    tmp55 = triton_helpers.maximum(tmp54, tmp7)
    tmp56 = triton_helpers.minimum(tmp55, tmp4)
    tmp57 = tmp37 * tmp56
    tmp58 = tmp36 + tmp57
    tmp59 = tmp52 * tmp56
    tmp60 = tmp51 + tmp59
    tmp61 = tl.load(in_ptr2 + (1 + tmp22 + 5 * tmp13 + 20 * x2), xmask,
        eviction_policy='evict_last')
    tmp62 = tl.load(in_ptr2 + (tmp22 + 5 * tmp13 + 20 * x2), xmask,
        eviction_policy='evict_last')
    tmp63 = tmp61 - tmp62
    tmp64 = tmp63 / tmp28
    tmp65 = tl.load(in_ptr2 + (1 + tmp20 + 5 * tmp13 + 20 * x2), xmask,
        eviction_policy='evict_last')
    tmp66 = tl.load(in_ptr2 + (tmp20 + 5 * tmp13 + 20 * x2), xmask,
        eviction_policy='evict_last')
    tmp67 = tmp65 - tmp66
    tmp68 = tmp67 / tmp35
    tmp69 = tmp64 - tmp68
    tmp70 = tl.load(in_ptr2 + (1 + tmp22 + 5 * tmp9 + 20 * x2), xmask,
        eviction_policy='evict_last')
    tmp71 = tl.load(in_ptr2 + (tmp22 + 5 * tmp9 + 20 * x2), xmask,
        eviction_policy='evict_last')
    tmp72 = tmp70 - tmp71
    tmp73 = tmp72 / tmp43
    tmp74 = tl.load(in_ptr2 + (1 + tmp20 + 5 * tmp9 + 20 * x2), xmask,
        eviction_policy='evict_last')
    tmp75 = tl.load(in_ptr2 + (tmp20 + 5 * tmp9 + 20 * x2), xmask,
        eviction_policy='evict_last')
    tmp76 = tmp74 - tmp75
    tmp77 = tmp76 / tmp50
    tmp78 = tmp73 - tmp77
    tmp79 = tmp69 * tmp56
    tmp80 = tmp68 + tmp79
    tmp81 = tmp78 * tmp56
    tmp82 = tmp77 + tmp81
    tl.store(in_out_ptr0 + x4, tmp58, xmask)
    tl.store(in_out_ptr1 + x4, tmp60, xmask)
    tl.store(in_out_ptr2 + x4, tmp80, xmask)
    tl.store(in_out_ptr3 + x4, tmp82, xmask)


@triton.jit
def triton_poi_fused__to_copy_add_clamp_div_mean_mul_std_sub_9(in_out_ptr0,
    in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5, in_ptr6, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex // 64
    x4 = xindex % 16
    x1 = xindex // 4 % 4
    x5 = xindex
    tmp0 = tl.load(in_ptr0 + (x4 + 16 * x3), xmask, eviction_policy=
        'evict_last')
    tmp1 = tl.load(in_ptr1 + (x4 + 16 * x3), xmask, eviction_policy=
        'evict_last')
    tmp19 = tl.load(in_ptr2 + x5, xmask)
    tmp20 = tl.load(in_ptr3 + x3, xmask, eviction_policy='evict_last')
    tmp27 = tl.load(in_ptr4 + x3, xmask, eviction_policy='evict_last')
    tmp33 = tl.load(in_ptr5 + (x4 + 16 * x3), xmask, eviction_policy=
        'evict_last')
    tmp34 = tl.load(in_ptr6 + (x4 + 16 * x3), xmask, eviction_policy=
        'evict_last')
    tmp2 = tmp1 - tmp0
    tmp3 = x1
    tmp4 = tmp3.to(tl.float32)
    tmp5 = 0.5
    tmp6 = tmp4 + tmp5
    tmp7 = 1.0
    tmp8 = tmp6 * tmp7
    tmp9 = tmp8 - tmp5
    tmp10 = 0.0
    tmp11 = triton_helpers.maximum(tmp9, tmp10)
    tmp12 = tmp11.to(tl.int32)
    tmp13 = tmp12.to(tl.float32)
    tmp14 = tmp11 - tmp13
    tmp15 = triton_helpers.maximum(tmp14, tmp10)
    tmp16 = triton_helpers.minimum(tmp15, tmp7)
    tmp17 = tmp2 * tmp16
    tmp18 = tmp0 + tmp17
    tmp21 = 63.0
    tmp22 = tmp20 / tmp21
    tmp23 = libdevice.sqrt(tmp22)
    tmp24 = 0.001
    tmp25 = tmp23 + tmp24
    tmp26 = tmp19 / tmp25
    tmp28 = 64.0
    tmp29 = tmp27 / tmp28
    tmp30 = tmp29 / tmp25
    tmp31 = tmp26 - tmp30
    tmp32 = tmp18 * tmp31
    tmp35 = tmp34 - tmp33
    tmp36 = tmp35 * tmp16
    tmp37 = tmp33 + tmp36
    tmp38 = tmp32 + tmp37
    tl.store(in_out_ptr0 + x5, tmp38, xmask)


def call(args):
    arg0_1, = args
    args.clear()
    assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf1 = empty_strided_cuda((4, 1, 1, 1), (1, 4, 4, 4), torch.float32)
        buf3 = empty_strided_cuda((4, 1, 1, 1), (1, 4, 4, 4), torch.float32)
        get_raw_stream(0)
        triton_per_fused_mean_std_0[grid(4)](arg0_1, buf1, buf3, 4, 64,
            XBLOCK=1, num_warps=2, num_stages=1)
        buf4 = empty_strided_cuda((4, 4, 5, 5), (100, 25, 5, 1), torch.float32)
        buf9 = empty_strided_cuda((4, 4, 5, 5), (100, 25, 5, 1), torch.float32)
        triton_per_fused_add_constant_pad_nd_cumsum_div_mean_pow_std_sub_1[grid
            (80)](arg0_1, buf1, buf3, buf4, buf9, 80, 5, XBLOCK=8,
            num_warps=2, num_stages=1)
        buf5 = empty_strided_cuda((4, 4, 4, 5), (80, 20, 5, 1), torch.float32)
        triton_per_fused_cumsum_sub_2[grid(64)](buf4, buf5, 64, 5, XBLOCK=1,
            num_warps=2, num_stages=1)
        del buf4
        buf6 = empty_strided_cuda((1, 1, 5, 5), (25, 25, 5, 1), torch.float32)
        triton_per_fused_constant_pad_nd_cumsum_ones_3[grid(5)](buf6, 5, 5,
            XBLOCK=8, num_warps=2, num_stages=1)
        buf7 = empty_strided_cuda((1, 1, 4, 5), (20, 20, 5, 1), torch.float32)
        triton_per_fused_cumsum_sub_4[grid(4)](buf6, buf7, 4, 5, XBLOCK=1,
            num_warps=2, num_stages=1)
        del buf6
        buf10 = empty_strided_cuda((4, 4, 4, 5), (80, 20, 5, 1), torch.float32)
        triton_per_fused_cumsum_sub_2[grid(64)](buf9, buf10, 64, 5, XBLOCK=
            1, num_warps=2, num_stages=1)
        del buf9
        buf8 = empty_strided_cuda((4, 1, 4, 4), (16, 64, 4, 1), torch.float32)
        buf11 = empty_strided_cuda((4, 1, 4, 4), (16, 64, 4, 1), torch.float32)
        triton_poi_fused_div_mean_sub_5[grid(64)](buf5, buf7, buf10, buf8,
            buf11, 64, XBLOCK=64, num_warps=1, num_stages=1)
        del buf10
        del buf5
        buf12 = empty_strided_cuda((4, 1, 5, 5), (25, 100, 5, 1), torch.float32
            )
        buf19 = empty_strided_cuda((4, 1, 5, 5), (25, 100, 5, 1), torch.float32
            )
        triton_per_fused_add_clamp_constant_pad_nd_cumsum_div_mul_neg_pow_reciprocal_sqrt_sub_6[
            grid(20)](buf8, buf11, buf12, buf19, 20, 5, XBLOCK=1, num_warps
            =2, num_stages=1)
        buf13 = empty_strided_cuda((4, 1, 4, 5), (20, 80, 5, 1), torch.float32)
        triton_per_fused_cumsum_sub_7[grid(16)](buf12, buf13, 16, 5, XBLOCK
            =1, num_warps=2, num_stages=1)
        del buf12
        buf20 = empty_strided_cuda((4, 1, 4, 5), (20, 80, 5, 1), torch.float32)
        triton_per_fused_cumsum_sub_7[grid(16)](buf19, buf20, 16, 5, XBLOCK
            =1, num_warps=2, num_stages=1)
        del buf19
        buf14 = buf8
        del buf8
        buf16 = buf11
        del buf11
        buf15 = buf14
        del buf14
        buf17 = buf16
        del buf16
        buf21 = empty_strided_cuda((4, 1, 4, 4), (16, 64, 4, 1), torch.float32)
        buf23 = empty_strided_cuda((4, 1, 4, 4), (16, 64, 4, 1), torch.float32)
        buf22 = buf21
        del buf21
        buf24 = buf23
        del buf23
        triton_poi_fused__to_copy__unsafe_index_add_arange_clamp_div_mul_sub_8[
            grid(64)](buf15, buf17, buf22, buf24, buf13, buf7, buf20, 64,
            XBLOCK=64, num_warps=1, num_stages=1)
        del buf13
        del buf20
        del buf7
        buf18 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf25 = buf18
        del buf18
        triton_poi_fused__to_copy_add_clamp_div_mean_mul_std_sub_9[grid(256)](
            buf25, buf17, buf15, arg0_1, buf1, buf3, buf24, buf22, 256,
            XBLOCK=256, num_warps=4, num_stages=1)
        del arg0_1
        del buf1
        del buf15
        del buf17
        del buf22
        del buf24
        del buf3
    return buf25,


def box_filter(x, k):
    if k % 2 == 0:
        k = k + 1
    p = k // 2
    xp = F.pad(x, (1 + p, p, 1 + p, p), mode='constant', value=0)
    x_cumsum = xp.cumsum(dim=2)
    y = x_cumsum[:, :, k:, :] - x_cumsum[:, :, :-k, :]
    y_cumsum = y.cumsum(dim=3)
    z = y_cumsum[:, :, :, k:] - y_cumsum[:, :, :, :-k]
    return z


class ReceptiveFieldNormNew(nn.Module):

    def __init__(self, min_scale=1 / 20, max_scale=1 / 5, eps=0.001, rate=4,
        subsample=3, coarse_to_fine=True):
        super(ReceptiveFieldNormNew, self).__init__()
        self.eps = eps
        self.subsample = subsample
        self.min_scale = min_scale
        self.max_scale = max_scale
        self.rate = rate
        self.coarse_to_fine = coarse_to_fine

    def forward(self, input_0):
        arg0_1 = input_0
        output = call([arg0_1])
        return output[0]


Measured latency_ms: 0.179632