# AOT ID: ['0_inference']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _align as align
from torch import device, empty_strided
from torch._inductor.async_compile import AsyncCompile
from torch._inductor.select_algorithm import extern_kernels
from torch._inductor.codegen.multi_kernel import MultiKernelCall
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph
from torch._C import _cuda_getCurrentRawStream as get_raw_stream

aten = torch.ops.aten
inductor_ops = torch.ops.inductor
_quantized = torch.ops._quantized
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
alloc_from_pool = torch.ops.inductor._alloc_from_pool
async_compile = AsyncCompile()


# kernel path: runs/run_shard_1/inductor_cache/su/csutjmytdgtn7lxtswpexbo3auoybwld7pu6ifrm5zfs7csmhuml.py
# Topologically Sorted Source Nodes: [mul, sum_1, inter, add_1, pow_1, sum_3, sum_4, pow_2, sum_5, sum_6, add, mul_1, sum_7, sum_8, union, add_2, iou, iou_1, sub_1], Original ATen: [aten.mul, aten.sum, aten.add, aten.pow, aten.sub, aten.div, aten.mean, aten.rsub]
# Source node to ATen node mapping:
#   add => add
#   add_1 => add_1
#   add_2 => add_2
#   inter => sum_2
#   iou => div
#   iou_1 => mean
#   mul => mul
#   mul_1 => mul_1
#   pow_1 => pow_1
#   pow_2 => pow_2
#   sub_1 => sub_1
#   sum_1 => sum_1
#   sum_3 => sum_3
#   sum_4 => sum_4
#   sum_5 => sum_5
#   sum_6 => sum_6
#   sum_7 => sum_7
#   sum_8 => sum_8
#   union => sub
# Graph fragment:
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg0_1, %arg1_1), kwargs = {})
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%mul, [-1]), kwargs = {})
#   %sum_2 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%sum_1, [-1]), kwargs = {})
#   %add_1 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%sum_2, 1e-06), kwargs = {})
#   %pow_1 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%arg0_1, 2), kwargs = {})
#   %sum_3 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%pow_1, [-1]), kwargs = {})
#   %sum_4 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%sum_3, [-1]), kwargs = {})
#   %pow_2 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%arg1_1, 2), kwargs = {})
#   %sum_5 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%pow_2, [-1]), kwargs = {})
#   %sum_6 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%sum_5, [-1]), kwargs = {})
#   %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%sum_4, %sum_6), kwargs = {})
#   %mul_1 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg0_1, %arg1_1), kwargs = {})
#   %sum_7 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%mul_1, [-1]), kwargs = {})
#   %sum_8 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%sum_7, [-1]), kwargs = {})
#   %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%add, %sum_8), kwargs = {})
#   %add_2 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%sub, 1e-06), kwargs = {})
#   %div : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%add_1, %add_2), kwargs = {})
#   %mean : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%div,), kwargs = {})
#   %sub_1 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (1, %mean), kwargs = {})
triton_per_fused_add_div_mean_mul_pow_rsub_sub_sum_0 = async_compile.triton('triton_per_fused_add_div_mean_mul_pow_rsub_sub_sum_0', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.persistent_reduction(
    size_hints=[1, 16],
    reduction_hint=ReductionHint.DEFAULT,
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: 'i32', 4: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=90, major=9, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=132), 'constants': {3: 1}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 4), equal_to_1=(3,))]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_per_fused_add_div_mean_mul_pow_rsub_sub_sum_0', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 32, 'num_reduction': 1, 'backend_hash': 'B098E03CDA7B8ADC90DAFFDF24A2956451D1B13F297756A5DCC209498AA53705', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False}
)
@triton.jit
def triton_per_fused_add_div_mean_mul_pow_rsub_sub_sum_0(in_out_ptr0, in_ptr0, in_ptr1, xnumel, rnumel, XBLOCK : tl.constexpr):
    xnumel = 1
    rnumel = 16
    RBLOCK: tl.constexpr = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = tl.full([XBLOCK, RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[None, :]
    roffset = 0
    rmask = tl.full([XBLOCK, RBLOCK], True, tl.int1)
    r0 = rindex
    tmp0 = tl.load(in_ptr0 + (16*r0), None, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr0 + (1 + (16*r0)), None, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (2 + (16*r0)), None, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr0 + (3 + (16*r0)), None, eviction_policy='evict_last')
    tmp11 = tl.load(in_ptr0 + (4 + (16*r0)), None, eviction_policy='evict_last')
    tmp13 = tl.load(in_ptr0 + (5 + (16*r0)), None, eviction_policy='evict_last')
    tmp16 = tl.load(in_ptr0 + (6 + (16*r0)), None, eviction_policy='evict_last')
    tmp19 = tl.load(in_ptr0 + (7 + (16*r0)), None, eviction_policy='evict_last')
    tmp23 = tl.load(in_ptr0 + (8 + (16*r0)), None, eviction_policy='evict_last')
    tmp25 = tl.load(in_ptr0 + (9 + (16*r0)), None, eviction_policy='evict_last')
    tmp28 = tl.load(in_ptr0 + (10 + (16*r0)), None, eviction_policy='evict_last')
    tmp31 = tl.load(in_ptr0 + (11 + (16*r0)), None, eviction_policy='evict_last')
    tmp35 = tl.load(in_ptr0 + (12 + (16*r0)), None, eviction_policy='evict_last')
    tmp37 = tl.load(in_ptr0 + (13 + (16*r0)), None, eviction_policy='evict_last')
    tmp40 = tl.load(in_ptr0 + (14 + (16*r0)), None, eviction_policy='evict_last')
    tmp43 = tl.load(in_ptr0 + (15 + (16*r0)), None, eviction_policy='evict_last')
    tmp47 = tl.load(in_ptr1 + (16*r0), None, eviction_policy='evict_last')
    tmp49 = tl.load(in_ptr1 + (1 + (16*r0)), None, eviction_policy='evict_last')
    tmp52 = tl.load(in_ptr1 + (2 + (16*r0)), None, eviction_policy='evict_last')
    tmp55 = tl.load(in_ptr1 + (3 + (16*r0)), None, eviction_policy='evict_last')
    tmp58 = tl.load(in_ptr1 + (4 + (16*r0)), None, eviction_policy='evict_last')
    tmp60 = tl.load(in_ptr1 + (5 + (16*r0)), None, eviction_policy='evict_last')
    tmp63 = tl.load(in_ptr1 + (6 + (16*r0)), None, eviction_policy='evict_last')
    tmp66 = tl.load(in_ptr1 + (7 + (16*r0)), None, eviction_policy='evict_last')
    tmp70 = tl.load(in_ptr1 + (8 + (16*r0)), None, eviction_policy='evict_last')
    tmp72 = tl.load(in_ptr1 + (9 + (16*r0)), None, eviction_policy='evict_last')
    tmp75 = tl.load(in_ptr1 + (10 + (16*r0)), None, eviction_policy='evict_last')
    tmp78 = tl.load(in_ptr1 + (11 + (16*r0)), None, eviction_policy='evict_last')
    tmp82 = tl.load(in_ptr1 + (12 + (16*r0)), None, eviction_policy='evict_last')
    tmp84 = tl.load(in_ptr1 + (13 + (16*r0)), None, eviction_policy='evict_last')
    tmp87 = tl.load(in_ptr1 + (14 + (16*r0)), None, eviction_policy='evict_last')
    tmp90 = tl.load(in_ptr1 + (15 + (16*r0)), None, eviction_policy='evict_last')
    tmp1 = tmp0 * tmp0
    tmp3 = tmp2 * tmp2
    tmp4 = tmp1 + tmp3
    tmp6 = tmp5 * tmp5
    tmp7 = tmp4 + tmp6
    tmp9 = tmp8 * tmp8
    tmp10 = tmp7 + tmp9
    tmp12 = tmp11 * tmp11
    tmp14 = tmp13 * tmp13
    tmp15 = tmp12 + tmp14
    tmp17 = tmp16 * tmp16
    tmp18 = tmp15 + tmp17
    tmp20 = tmp19 * tmp19
    tmp21 = tmp18 + tmp20
    tmp22 = tmp10 + tmp21
    tmp24 = tmp23 * tmp23
    tmp26 = tmp25 * tmp25
    tmp27 = tmp24 + tmp26
    tmp29 = tmp28 * tmp28
    tmp30 = tmp27 + tmp29
    tmp32 = tmp31 * tmp31
    tmp33 = tmp30 + tmp32
    tmp34 = tmp22 + tmp33
    tmp36 = tmp35 * tmp35
    tmp38 = tmp37 * tmp37
    tmp39 = tmp36 + tmp38
    tmp41 = tmp40 * tmp40
    tmp42 = tmp39 + tmp41
    tmp44 = tmp43 * tmp43
    tmp45 = tmp42 + tmp44
    tmp46 = tmp34 + tmp45
    tmp48 = tmp47 * tmp0
    tmp50 = tmp49 * tmp2
    tmp51 = tmp48 + tmp50
    tmp53 = tmp52 * tmp5
    tmp54 = tmp51 + tmp53
    tmp56 = tmp55 * tmp8
    tmp57 = tmp54 + tmp56
    tmp59 = tmp58 * tmp11
    tmp61 = tmp60 * tmp13
    tmp62 = tmp59 + tmp61
    tmp64 = tmp63 * tmp16
    tmp65 = tmp62 + tmp64
    tmp67 = tmp66 * tmp19
    tmp68 = tmp65 + tmp67
    tmp69 = tmp57 + tmp68
    tmp71 = tmp70 * tmp23
    tmp73 = tmp72 * tmp25
    tmp74 = tmp71 + tmp73
    tmp76 = tmp75 * tmp28
    tmp77 = tmp74 + tmp76
    tmp79 = tmp78 * tmp31
    tmp80 = tmp77 + tmp79
    tmp81 = tmp69 + tmp80
    tmp83 = tmp82 * tmp35
    tmp85 = tmp84 * tmp37
    tmp86 = tmp83 + tmp85
    tmp88 = tmp87 * tmp40
    tmp89 = tmp86 + tmp88
    tmp91 = tmp90 * tmp43
    tmp92 = tmp89 + tmp91
    tmp93 = tmp81 + tmp92
    tmp94 = tmp47 * tmp47
    tmp95 = tmp49 * tmp49
    tmp96 = tmp94 + tmp95
    tmp97 = tmp52 * tmp52
    tmp98 = tmp96 + tmp97
    tmp99 = tmp55 * tmp55
    tmp100 = tmp98 + tmp99
    tmp101 = tmp58 * tmp58
    tmp102 = tmp60 * tmp60
    tmp103 = tmp101 + tmp102
    tmp104 = tmp63 * tmp63
    tmp105 = tmp103 + tmp104
    tmp106 = tmp66 * tmp66
    tmp107 = tmp105 + tmp106
    tmp108 = tmp100 + tmp107
    tmp109 = tmp70 * tmp70
    tmp110 = tmp72 * tmp72
    tmp111 = tmp109 + tmp110
    tmp112 = tmp75 * tmp75
    tmp113 = tmp111 + tmp112
    tmp114 = tmp78 * tmp78
    tmp115 = tmp113 + tmp114
    tmp116 = tmp108 + tmp115
    tmp117 = tmp82 * tmp82
    tmp118 = tmp84 * tmp84
    tmp119 = tmp117 + tmp118
    tmp120 = tmp87 * tmp87
    tmp121 = tmp119 + tmp120
    tmp122 = tmp90 * tmp90
    tmp123 = tmp121 + tmp122
    tmp124 = tmp116 + tmp123
    tmp125 = 1e-06
    tmp126 = tmp93 + tmp125
    tmp127 = tmp124 + tmp46
    tmp128 = tmp127 - tmp93
    tmp129 = tmp128 + tmp125
    tmp130 = tmp126 / tmp129
    tmp131 = tl.broadcast_to(tmp130, [XBLOCK, RBLOCK])
    tmp133 = tl.sum(tmp131, 1)[:, None]
    tmp134 = 16.0
    tmp135 = tmp133 / tmp134
    tmp136 = 1.0
    tmp137 = tmp136 - tmp135
    tl.debug_barrier()
    tl.store(in_out_ptr0 + (tl.full([XBLOCK, 1], 0, tl.int32)), tmp137, None)
''', device_str='cuda')


async_compile.wait(globals())
del async_compile

def call(args):
    arg0_1, arg1_1 = args
    args.clear()
    assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(arg1_1, (4, 4, 4, 4), (64, 16, 4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf4 = empty_strided_cuda((), (), torch.float32)
        buf5 = buf4; del buf4  # reuse
        # Topologically Sorted Source Nodes: [mul, sum_1, inter, add_1, pow_1, sum_3, sum_4, pow_2, sum_5, sum_6, add, mul_1, sum_7, sum_8, union, add_2, iou, iou_1, sub_1], Original ATen: [aten.mul, aten.sum, aten.add, aten.pow, aten.sub, aten.div, aten.mean, aten.rsub]
        stream0 = get_raw_stream(0)
        triton_per_fused_add_div_mean_mul_pow_rsub_sub_sum_0.run(buf5, arg1_1, arg0_1, 1, 16, grid=grid(1), stream=stream0)
        del arg0_1
        del arg1_1
    return (buf5, )


def benchmark_compiled_module(times=10, repeat=10):
    from torch._dynamo.testing import rand_strided
    from torch._inductor.utils import print_performance
    arg0_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    arg1_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    fn = lambda: call([arg0_1, arg1_1])
    return print_performance(fn, times=times, repeat=repeat)


if __name__ == "__main__":
    from torch._inductor.wrapper_benchmark import compiled_module_main
    compiled_module_main('None', benchmark_compiled_module)

import torch
import torch.nn as nn


class IoULoss(nn.Module):
    """
    Intersection over Union Loss.
    IoU = Area of Overlap / Area of Union
    IoU loss is modified to use for heatmaps.
    """

    def __init__(self):
        super(IoULoss, self).__init__()
        self.EPSILON = 1e-06

    def _op_sum(self, x):
        return x.sum(-1).sum(-1)

    def forward(self, y_pred, y_true):
        inter = self._op_sum(y_true * y_pred)
        union = self._op_sum(y_true ** 2) + self._op_sum(y_pred ** 2
            ) - self._op_sum(y_true * y_pred)
        iou = (inter + self.EPSILON) / (union + self.EPSILON)
        iou = torch.mean(iou)
        return 1 - iou


def get_inputs():
    return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]


def get_init_inputs():
    return [[], {}]

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
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


@triton.jit
def triton_per_fused_add_div_mean_mul_pow_rsub_sub_sum_0(in_out_ptr0,
    in_ptr0, in_ptr1, xnumel, rnumel, XBLOCK: tl.constexpr):
    RBLOCK: tl.constexpr = 16
    xoffset = tl.program_id(0) * XBLOCK
    xoffset + tl.arange(0, XBLOCK)[:, None]
    tl.full([XBLOCK, RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[None, :]
    tl.full([XBLOCK, RBLOCK], True, tl.int1)
    r0 = rindex
    tmp0 = tl.load(in_ptr0 + 16 * r0, None, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr0 + (1 + 16 * r0), None, eviction_policy='evict_last')
    tmp5 = tl.load(in_ptr0 + (2 + 16 * r0), None, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr0 + (3 + 16 * r0), None, eviction_policy='evict_last')
    tmp11 = tl.load(in_ptr0 + (4 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp13 = tl.load(in_ptr0 + (5 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp16 = tl.load(in_ptr0 + (6 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp19 = tl.load(in_ptr0 + (7 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp23 = tl.load(in_ptr0 + (8 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp25 = tl.load(in_ptr0 + (9 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp28 = tl.load(in_ptr0 + (10 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp31 = tl.load(in_ptr0 + (11 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp35 = tl.load(in_ptr0 + (12 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp37 = tl.load(in_ptr0 + (13 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp40 = tl.load(in_ptr0 + (14 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp43 = tl.load(in_ptr0 + (15 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp47 = tl.load(in_ptr1 + 16 * r0, None, eviction_policy='evict_last')
    tmp49 = tl.load(in_ptr1 + (1 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp52 = tl.load(in_ptr1 + (2 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp55 = tl.load(in_ptr1 + (3 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp58 = tl.load(in_ptr1 + (4 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp60 = tl.load(in_ptr1 + (5 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp63 = tl.load(in_ptr1 + (6 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp66 = tl.load(in_ptr1 + (7 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp70 = tl.load(in_ptr1 + (8 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp72 = tl.load(in_ptr1 + (9 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp75 = tl.load(in_ptr1 + (10 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp78 = tl.load(in_ptr1 + (11 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp82 = tl.load(in_ptr1 + (12 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp84 = tl.load(in_ptr1 + (13 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp87 = tl.load(in_ptr1 + (14 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp90 = tl.load(in_ptr1 + (15 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp1 = tmp0 * tmp0
    tmp3 = tmp2 * tmp2
    tmp4 = tmp1 + tmp3
    tmp6 = tmp5 * tmp5
    tmp7 = tmp4 + tmp6
    tmp9 = tmp8 * tmp8
    tmp10 = tmp7 + tmp9
    tmp12 = tmp11 * tmp11
    tmp14 = tmp13 * tmp13
    tmp15 = tmp12 + tmp14
    tmp17 = tmp16 * tmp16
    tmp18 = tmp15 + tmp17
    tmp20 = tmp19 * tmp19
    tmp21 = tmp18 + tmp20
    tmp22 = tmp10 + tmp21
    tmp24 = tmp23 * tmp23
    tmp26 = tmp25 * tmp25
    tmp27 = tmp24 + tmp26
    tmp29 = tmp28 * tmp28
    tmp30 = tmp27 + tmp29
    tmp32 = tmp31 * tmp31
    tmp33 = tmp30 + tmp32
    tmp34 = tmp22 + tmp33
    tmp36 = tmp35 * tmp35
    tmp38 = tmp37 * tmp37
    tmp39 = tmp36 + tmp38
    tmp41 = tmp40 * tmp40
    tmp42 = tmp39 + tmp41
    tmp44 = tmp43 * tmp43
    tmp45 = tmp42 + tmp44
    tmp46 = tmp34 + tmp45
    tmp48 = tmp47 * tmp0
    tmp50 = tmp49 * tmp2
    tmp51 = tmp48 + tmp50
    tmp53 = tmp52 * tmp5
    tmp54 = tmp51 + tmp53
    tmp56 = tmp55 * tmp8
    tmp57 = tmp54 + tmp56
    tmp59 = tmp58 * tmp11
    tmp61 = tmp60 * tmp13
    tmp62 = tmp59 + tmp61
    tmp64 = tmp63 * tmp16
    tmp65 = tmp62 + tmp64
    tmp67 = tmp66 * tmp19
    tmp68 = tmp65 + tmp67
    tmp69 = tmp57 + tmp68
    tmp71 = tmp70 * tmp23
    tmp73 = tmp72 * tmp25
    tmp74 = tmp71 + tmp73
    tmp76 = tmp75 * tmp28
    tmp77 = tmp74 + tmp76
    tmp79 = tmp78 * tmp31
    tmp80 = tmp77 + tmp79
    tmp81 = tmp69 + tmp80
    tmp83 = tmp82 * tmp35
    tmp85 = tmp84 * tmp37
    tmp86 = tmp83 + tmp85
    tmp88 = tmp87 * tmp40
    tmp89 = tmp86 + tmp88
    tmp91 = tmp90 * tmp43
    tmp92 = tmp89 + tmp91
    tmp93 = tmp81 + tmp92
    tmp94 = tmp47 * tmp47
    tmp95 = tmp49 * tmp49
    tmp96 = tmp94 + tmp95
    tmp97 = tmp52 * tmp52
    tmp98 = tmp96 + tmp97
    tmp99 = tmp55 * tmp55
    tmp100 = tmp98 + tmp99
    tmp101 = tmp58 * tmp58
    tmp102 = tmp60 * tmp60
    tmp103 = tmp101 + tmp102
    tmp104 = tmp63 * tmp63
    tmp105 = tmp103 + tmp104
    tmp106 = tmp66 * tmp66
    tmp107 = tmp105 + tmp106
    tmp108 = tmp100 + tmp107
    tmp109 = tmp70 * tmp70
    tmp110 = tmp72 * tmp72
    tmp111 = tmp109 + tmp110
    tmp112 = tmp75 * tmp75
    tmp113 = tmp111 + tmp112
    tmp114 = tmp78 * tmp78
    tmp115 = tmp113 + tmp114
    tmp116 = tmp108 + tmp115
    tmp117 = tmp82 * tmp82
    tmp118 = tmp84 * tmp84
    tmp119 = tmp117 + tmp118
    tmp120 = tmp87 * tmp87
    tmp121 = tmp119 + tmp120
    tmp122 = tmp90 * tmp90
    tmp123 = tmp121 + tmp122
    tmp124 = tmp116 + tmp123
    tmp125 = 1e-06
    tmp126 = tmp93 + tmp125
    tmp127 = tmp124 + tmp46
    tmp128 = tmp127 - tmp93
    tmp129 = tmp128 + tmp125
    tmp130 = tmp126 / tmp129
    tmp131 = tl.broadcast_to(tmp130, [XBLOCK, RBLOCK])
    tmp133 = tl.sum(tmp131, 1)[:, None]
    tmp134 = 16.0
    tmp135 = tmp133 / tmp134
    tmp136 = 1.0
    tmp137 = tmp136 - tmp135
    tl.debug_barrier()
    tl.store(in_out_ptr0 + tl.full([XBLOCK, 1], 0, tl.int32), tmp137, None)


def call(args):
    arg0_1, arg1_1 = args
    args.clear()
    assert_size_stride(arg0_1, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(arg1_1, (4, 4, 4, 4), (64, 16, 4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf4 = empty_strided_cuda((), (), torch.float32)
        buf5 = buf4
        del buf4
        get_raw_stream(0)
        triton_per_fused_add_div_mean_mul_pow_rsub_sub_sum_0[grid(1)](buf5,
            arg1_1, arg0_1, 1, 16, XBLOCK=1, num_warps=2, num_stages=1)
        del arg0_1
        del arg1_1
    return buf5,


class IoULossNew(nn.Module):
    """
    Intersection over Union Loss.
    IoU = Area of Overlap / Area of Union
    IoU loss is modified to use for heatmaps.
    """

    def __init__(self):
        super(IoULossNew, self).__init__()
        self.EPSILON = 1e-06

    def _op_sum(self, x):
        return x.sum(-1).sum(-1)

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