# 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_7/inductor_cache/qu/cquevxnqtaowseusqpxu7qbmfixp6saj5lhcuq65hydyx4v6st4i.py
# Topologically Sorted Source Nodes: [pred1, gt1, mse_loss, pred2, gt2, mse_loss_1, add, total_loss, pred1_1, gt1_1, mse_loss_2, pred2_1, gt2_1, mse_loss_3, add_2, total_loss_1, pred1_2, gt1_2, mse_loss_4, pred2_2, gt2_2, mse_loss_5, add_3, total_loss_2, pred1_3, gt1_3, mse_loss_6, pred2_3, gt2_3, mse_loss_7, add_4, total_loss_3, pred1_4, gt1_4, mse_loss_8, pred2_4, gt2_4, mse_loss_9, add_5, total_loss_4, pred1_5, gt1_5, mse_loss_10, pred2_5, gt2_5, mse_loss_11, add_6, total_loss_5], Original ATen: [aten.mul, aten.mse_loss, aten.add]
# Source node to ATen node mapping:
#   add => add
#   add_2 => add_2
#   add_3 => add_4
#   add_4 => add_6
#   add_5 => add_8
#   add_6 => add_10
#   gt1 => mul_1
#   gt1_1 => mul_5
#   gt1_2 => mul_9
#   gt1_3 => mul_13
#   gt1_4 => mul_17
#   gt1_5 => mul_21
#   gt2 => mul_3
#   gt2_1 => mul_7
#   gt2_2 => mul_11
#   gt2_3 => mul_15
#   gt2_4 => mul_19
#   gt2_5 => mul_23
#   mse_loss => mean, pow_1, sub
#   mse_loss_1 => mean_1, pow_2, sub_1
#   mse_loss_10 => mean_10, pow_11, sub_10
#   mse_loss_11 => mean_11, pow_12, sub_11
#   mse_loss_2 => mean_2, pow_3, sub_2
#   mse_loss_3 => mean_3, pow_4, sub_3
#   mse_loss_4 => mean_4, pow_5, sub_4
#   mse_loss_5 => mean_5, pow_6, sub_5
#   mse_loss_6 => mean_6, pow_7, sub_6
#   mse_loss_7 => mean_7, pow_8, sub_7
#   mse_loss_8 => mean_8, pow_9, sub_8
#   mse_loss_9 => mean_9, pow_10, sub_9
#   pred1 => mul
#   pred1_1 => mul_4
#   pred1_2 => mul_8
#   pred1_3 => mul_12
#   pred1_4 => mul_16
#   pred1_5 => mul_20
#   pred2 => mul_2
#   pred2_1 => mul_6
#   pred2_2 => mul_10
#   pred2_3 => mul_14
#   pred2_4 => mul_18
#   pred2_5 => mul_22
#   total_loss => add_1
#   total_loss_1 => add_3
#   total_loss_2 => add_5
#   total_loss_3 => add_7
#   total_loss_4 => add_9
#   total_loss_5 => add_11
# Graph fragment:
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%select, %arg1_1), kwargs = {})
#   %mul_1 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg2_1, %arg1_1), kwargs = {})
#   %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul, %mul_1), kwargs = {})
#   %pow_1 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub, 2), kwargs = {})
#   %mean : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%pow_1,), kwargs = {})
#   %mul_2 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%select_1, %arg3_1), kwargs = {})
#   %mul_3 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg4_1, %arg3_1), kwargs = {})
#   %sub_1 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_2, %mul_3), kwargs = {})
#   %pow_2 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_1, 2), kwargs = {})
#   %mean_1 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%pow_2,), kwargs = {})
#   %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mean, %mean_1), kwargs = {})
#   %add_1 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add, 0), kwargs = {})
#   %mul_4 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%select_2, %arg1_1), kwargs = {})
#   %mul_5 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg2_1, %arg1_1), kwargs = {})
#   %sub_2 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_4, %mul_5), kwargs = {})
#   %pow_3 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_2, 2), kwargs = {})
#   %mean_2 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%pow_3,), kwargs = {})
#   %mul_6 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%select_3, %arg3_1), kwargs = {})
#   %mul_7 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg4_1, %arg3_1), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_6, %mul_7), kwargs = {})
#   %pow_4 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_3, 2), kwargs = {})
#   %mean_3 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%pow_4,), kwargs = {})
#   %add_2 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mean_2, %mean_3), kwargs = {})
#   %add_3 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_1, %add_2), kwargs = {})
#   %mul_8 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%select_4, %arg1_1), kwargs = {})
#   %mul_9 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg2_1, %arg1_1), kwargs = {})
#   %sub_4 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_8, %mul_9), kwargs = {})
#   %pow_5 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_4, 2), kwargs = {})
#   %mean_4 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%pow_5,), kwargs = {})
#   %mul_10 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%select_5, %arg3_1), kwargs = {})
#   %mul_11 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg4_1, %arg3_1), kwargs = {})
#   %sub_5 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_10, %mul_11), kwargs = {})
#   %pow_6 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_5, 2), kwargs = {})
#   %mean_5 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%pow_6,), kwargs = {})
#   %add_4 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mean_4, %mean_5), kwargs = {})
#   %add_5 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_3, %add_4), kwargs = {})
#   %mul_12 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%select_6, %arg1_1), kwargs = {})
#   %mul_13 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg2_1, %arg1_1), kwargs = {})
#   %sub_6 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_12, %mul_13), kwargs = {})
#   %pow_7 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_6, 2), kwargs = {})
#   %mean_6 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%pow_7,), kwargs = {})
#   %mul_14 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%select_7, %arg3_1), kwargs = {})
#   %mul_15 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg4_1, %arg3_1), kwargs = {})
#   %sub_7 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_14, %mul_15), kwargs = {})
#   %pow_8 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_7, 2), kwargs = {})
#   %mean_7 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%pow_8,), kwargs = {})
#   %add_6 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mean_6, %mean_7), kwargs = {})
#   %add_7 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_5, %add_6), kwargs = {})
#   %mul_16 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%select_8, %arg1_1), kwargs = {})
#   %mul_17 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg2_1, %arg1_1), kwargs = {})
#   %sub_8 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_16, %mul_17), kwargs = {})
#   %pow_9 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_8, 2), kwargs = {})
#   %mean_8 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%pow_9,), kwargs = {})
#   %mul_18 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%select_9, %arg3_1), kwargs = {})
#   %mul_19 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg4_1, %arg3_1), kwargs = {})
#   %sub_9 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_18, %mul_19), kwargs = {})
#   %pow_10 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_9, 2), kwargs = {})
#   %mean_9 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%pow_10,), kwargs = {})
#   %add_8 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mean_8, %mean_9), kwargs = {})
#   %add_9 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_7, %add_8), kwargs = {})
#   %mul_20 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%select_10, %arg1_1), kwargs = {})
#   %mul_21 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg2_1, %arg1_1), kwargs = {})
#   %sub_10 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_20, %mul_21), kwargs = {})
#   %pow_11 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_10, 2), kwargs = {})
#   %mean_10 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%pow_11,), kwargs = {})
#   %mul_22 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%select_11, %arg3_1), kwargs = {})
#   %mul_23 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg4_1, %arg3_1), kwargs = {})
#   %sub_11 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_22, %mul_23), kwargs = {})
#   %pow_12 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_11, 2), kwargs = {})
#   %mean_11 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%pow_12,), kwargs = {})
#   %add_10 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mean_10, %mean_11), kwargs = {})
#   %add_11 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_9, %add_10), kwargs = {})
triton_per_fused_add_mse_loss_mul_0 = async_compile.triton('triton_per_fused_add_mse_loss_mul_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, 256],
    reduction_hint=ReductionHint.INNER,
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*fp32', 5: '*fp32', 6: 'i32', 7: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {6: 1}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4, 5, 7), equal_to_1=(6,))]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_per_fused_add_mse_loss_mul_0', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': True, 'num_load': 16, 'num_reduction': 12, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', '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_mse_loss_mul_0(in_out_ptr0, in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4, xnumel, rnumel):
    xnumel = 1
    XBLOCK: tl.constexpr = 1
    rnumel = 256
    RBLOCK: tl.constexpr = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = tl.full([1], xoffset, tl.int32)
    xmask = tl.full([RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[:]
    roffset = 0
    rmask = tl.full([RBLOCK], True, tl.int1)
    r0 = rindex % 64
    r2 = rindex
    tmp0 = tl.load(in_ptr0 + (r0), None, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + (r2), None)
    tmp3 = tl.load(in_ptr2 + (r2), None)
    tmp10 = tl.load(in_ptr0 + (128 + r0), None, eviction_policy='evict_last')
    tmp17 = tl.load(in_ptr0 + (256 + r0), None, eviction_policy='evict_last')
    tmp24 = tl.load(in_ptr0 + (384 + r0), None, eviction_policy='evict_last')
    tmp31 = tl.load(in_ptr0 + (512 + r0), None, eviction_policy='evict_last')
    tmp38 = tl.load(in_ptr0 + (640 + r0), None, eviction_policy='evict_last')
    tmp45 = tl.load(in_ptr0 + (64 + r0), None, eviction_policy='evict_last')
    tmp46 = tl.load(in_ptr3 + (r2), None)
    tmp48 = tl.load(in_ptr4 + (r2), None)
    tmp55 = tl.load(in_ptr0 + (192 + r0), None, eviction_policy='evict_last')
    tmp62 = tl.load(in_ptr0 + (320 + r0), None, eviction_policy='evict_last')
    tmp69 = tl.load(in_ptr0 + (448 + r0), None, eviction_policy='evict_last')
    tmp76 = tl.load(in_ptr0 + (576 + r0), None, eviction_policy='evict_last')
    tmp83 = tl.load(in_ptr0 + (704 + r0), None, eviction_policy='evict_last')
    tmp2 = tmp0 * tmp1
    tmp4 = tmp3 * tmp1
    tmp5 = tmp2 - tmp4
    tmp6 = tmp5 * tmp5
    tmp7 = tl.broadcast_to(tmp6, [RBLOCK])
    tmp9 = triton_helpers.promote_to_tensor(tl.sum(tmp7, 0))
    tmp11 = tmp10 * tmp1
    tmp12 = tmp11 - tmp4
    tmp13 = tmp12 * tmp12
    tmp14 = tl.broadcast_to(tmp13, [RBLOCK])
    tmp16 = triton_helpers.promote_to_tensor(tl.sum(tmp14, 0))
    tmp18 = tmp17 * tmp1
    tmp19 = tmp18 - tmp4
    tmp20 = tmp19 * tmp19
    tmp21 = tl.broadcast_to(tmp20, [RBLOCK])
    tmp23 = triton_helpers.promote_to_tensor(tl.sum(tmp21, 0))
    tmp25 = tmp24 * tmp1
    tmp26 = tmp25 - tmp4
    tmp27 = tmp26 * tmp26
    tmp28 = tl.broadcast_to(tmp27, [RBLOCK])
    tmp30 = triton_helpers.promote_to_tensor(tl.sum(tmp28, 0))
    tmp32 = tmp31 * tmp1
    tmp33 = tmp32 - tmp4
    tmp34 = tmp33 * tmp33
    tmp35 = tl.broadcast_to(tmp34, [RBLOCK])
    tmp37 = triton_helpers.promote_to_tensor(tl.sum(tmp35, 0))
    tmp39 = tmp38 * tmp1
    tmp40 = tmp39 - tmp4
    tmp41 = tmp40 * tmp40
    tmp42 = tl.broadcast_to(tmp41, [RBLOCK])
    tmp44 = triton_helpers.promote_to_tensor(tl.sum(tmp42, 0))
    tmp47 = tmp45 * tmp46
    tmp49 = tmp48 * tmp46
    tmp50 = tmp47 - tmp49
    tmp51 = tmp50 * tmp50
    tmp52 = tl.broadcast_to(tmp51, [RBLOCK])
    tmp54 = triton_helpers.promote_to_tensor(tl.sum(tmp52, 0))
    tmp56 = tmp55 * tmp46
    tmp57 = tmp56 - tmp49
    tmp58 = tmp57 * tmp57
    tmp59 = tl.broadcast_to(tmp58, [RBLOCK])
    tmp61 = triton_helpers.promote_to_tensor(tl.sum(tmp59, 0))
    tmp63 = tmp62 * tmp46
    tmp64 = tmp63 - tmp49
    tmp65 = tmp64 * tmp64
    tmp66 = tl.broadcast_to(tmp65, [RBLOCK])
    tmp68 = triton_helpers.promote_to_tensor(tl.sum(tmp66, 0))
    tmp70 = tmp69 * tmp46
    tmp71 = tmp70 - tmp49
    tmp72 = tmp71 * tmp71
    tmp73 = tl.broadcast_to(tmp72, [RBLOCK])
    tmp75 = triton_helpers.promote_to_tensor(tl.sum(tmp73, 0))
    tmp77 = tmp76 * tmp46
    tmp78 = tmp77 - tmp49
    tmp79 = tmp78 * tmp78
    tmp80 = tl.broadcast_to(tmp79, [RBLOCK])
    tmp82 = triton_helpers.promote_to_tensor(tl.sum(tmp80, 0))
    tmp84 = tmp83 * tmp46
    tmp85 = tmp84 - tmp49
    tmp86 = tmp85 * tmp85
    tmp87 = tl.broadcast_to(tmp86, [RBLOCK])
    tmp89 = triton_helpers.promote_to_tensor(tl.sum(tmp87, 0))
    tmp90 = 256.0
    tmp91 = tmp9 / tmp90
    tmp92 = tmp54 / tmp90
    tmp93 = tmp91 + tmp92
    tmp94 = 0.0
    tmp95 = tmp93 + tmp94
    tmp96 = tmp16 / tmp90
    tmp97 = tmp61 / tmp90
    tmp98 = tmp96 + tmp97
    tmp99 = tmp95 + tmp98
    tmp100 = tmp23 / tmp90
    tmp101 = tmp68 / tmp90
    tmp102 = tmp100 + tmp101
    tmp103 = tmp99 + tmp102
    tmp104 = tmp30 / tmp90
    tmp105 = tmp75 / tmp90
    tmp106 = tmp104 + tmp105
    tmp107 = tmp103 + tmp106
    tmp108 = tmp37 / tmp90
    tmp109 = tmp82 / tmp90
    tmp110 = tmp108 + tmp109
    tmp111 = tmp107 + tmp110
    tmp112 = tmp44 / tmp90
    tmp113 = tmp89 / tmp90
    tmp114 = tmp112 + tmp113
    tmp115 = tmp111 + tmp114
    tl.debug_barrier()
    tl.store(in_out_ptr0 + (tl.full([1], 0, tl.int32)), tmp115, None)
''', device_str='cuda')


async_compile.wait(globals())
del async_compile

def call(args):
    arg0_1, arg1_1, arg2_1, arg3_1, arg4_1 = args
    args.clear()
    assert_size_stride(arg0_1, (12, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(arg1_1, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(arg2_1, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(arg3_1, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(arg4_1, (4, 4, 4, 4), (64, 16, 4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((), (), torch.float32)
        buf10 = buf0; del buf0  # reuse
        buf13 = buf10; del buf10  # reuse
        # Topologically Sorted Source Nodes: [pred1, gt1, mse_loss, pred2, gt2, mse_loss_1, add, total_loss, pred1_1, gt1_1, mse_loss_2, pred2_1, gt2_1, mse_loss_3, add_2, total_loss_1, pred1_2, gt1_2, mse_loss_4, pred2_2, gt2_2, mse_loss_5, add_3, total_loss_2, pred1_3, gt1_3, mse_loss_6, pred2_3, gt2_3, mse_loss_7, add_4, total_loss_3, pred1_4, gt1_4, mse_loss_8, pred2_4, gt2_4, mse_loss_9, add_5, total_loss_4, pred1_5, gt1_5, mse_loss_10, pred2_5, gt2_5, mse_loss_11, add_6, total_loss_5], Original ATen: [aten.mul, aten.mse_loss, aten.add]
        stream0 = get_raw_stream(0)
        triton_per_fused_add_mse_loss_mul_0.run(buf13, arg0_1, arg1_1, arg2_1, arg3_1, arg4_1, 1, 256, grid=grid(1), stream=stream0)
        del arg0_1
        del arg1_1
        del arg2_1
        del arg3_1
        del arg4_1
    return (buf13, )


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((12, 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)
    arg2_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    arg3_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    arg4_1 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    fn = lambda: call([arg0_1, arg1_1, arg2_1, arg3_1, arg4_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
import torch.nn.functional as F


class OpenPoseLoss(nn.Module):

    def __init__(self):
        super(OpenPoseLoss, self).__init__()

    def forward(self, saved_for_loss, heatmap_target, heat_mask, paf_target,
        paf_mask):
        """
        tính loss
        Parameters
        ----------
        saved_for_loss : Output ofOpenPoseNet (list)

        heatmap_target : [num_batch, 19, 46, 46]
            Anotation information

        heatmap_mask : [num_batch, 19, 46, 46]
            

        paf_target : [num_batch, 38, 46, 46]
            PAF Anotation

        paf_mask : [num_batch, 38, 46, 46]
            PAF mask

        Returns
        -------
        loss : 
        """
        total_loss = 0
        for j in range(6):
            pred1 = saved_for_loss[2 * j] * paf_mask
            gt1 = paf_target.float() * paf_mask
            pred2 = saved_for_loss[2 * j + 1] * heat_mask
            gt2 = heatmap_target.float() * heat_mask
            total_loss += F.mse_loss(pred1, gt1, reduction='mean'
                ) + F.mse_loss(pred2, gt2, reduction='mean')
        return total_loss


def get_inputs():
    return [torch.rand([12, 4, 4, 4]), torch.rand([4, 4, 4, 4]), torch.rand
        ([4, 4, 4, 4]), 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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda


@triton.jit
def triton_per_fused_add_mse_loss_mul_0(in_out_ptr0, in_ptr0, in_ptr1,
    in_ptr2, in_ptr3, in_ptr4, xnumel, rnumel):
    XBLOCK: tl.constexpr = 1
    RBLOCK: tl.constexpr = 256
    xoffset = tl.program_id(0) * XBLOCK
    tl.full([1], xoffset, tl.int32)
    tl.full([RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[:]
    tl.full([RBLOCK], True, tl.int1)
    r0 = rindex % 64
    r2 = rindex
    tmp0 = tl.load(in_ptr0 + r0, None, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + r2, None)
    tmp3 = tl.load(in_ptr2 + r2, None)
    tmp10 = tl.load(in_ptr0 + (128 + r0), None, eviction_policy='evict_last')
    tmp17 = tl.load(in_ptr0 + (256 + r0), None, eviction_policy='evict_last')
    tmp24 = tl.load(in_ptr0 + (384 + r0), None, eviction_policy='evict_last')
    tmp31 = tl.load(in_ptr0 + (512 + r0), None, eviction_policy='evict_last')
    tmp38 = tl.load(in_ptr0 + (640 + r0), None, eviction_policy='evict_last')
    tmp45 = tl.load(in_ptr0 + (64 + r0), None, eviction_policy='evict_last')
    tmp46 = tl.load(in_ptr3 + r2, None)
    tmp48 = tl.load(in_ptr4 + r2, None)
    tmp55 = tl.load(in_ptr0 + (192 + r0), None, eviction_policy='evict_last')
    tmp62 = tl.load(in_ptr0 + (320 + r0), None, eviction_policy='evict_last')
    tmp69 = tl.load(in_ptr0 + (448 + r0), None, eviction_policy='evict_last')
    tmp76 = tl.load(in_ptr0 + (576 + r0), None, eviction_policy='evict_last')
    tmp83 = tl.load(in_ptr0 + (704 + r0), None, eviction_policy='evict_last')
    tmp2 = tmp0 * tmp1
    tmp4 = tmp3 * tmp1
    tmp5 = tmp2 - tmp4
    tmp6 = tmp5 * tmp5
    tmp7 = tl.broadcast_to(tmp6, [RBLOCK])
    tmp9 = triton_helpers.promote_to_tensor(tl.sum(tmp7, 0))
    tmp11 = tmp10 * tmp1
    tmp12 = tmp11 - tmp4
    tmp13 = tmp12 * tmp12
    tmp14 = tl.broadcast_to(tmp13, [RBLOCK])
    tmp16 = triton_helpers.promote_to_tensor(tl.sum(tmp14, 0))
    tmp18 = tmp17 * tmp1
    tmp19 = tmp18 - tmp4
    tmp20 = tmp19 * tmp19
    tmp21 = tl.broadcast_to(tmp20, [RBLOCK])
    tmp23 = triton_helpers.promote_to_tensor(tl.sum(tmp21, 0))
    tmp25 = tmp24 * tmp1
    tmp26 = tmp25 - tmp4
    tmp27 = tmp26 * tmp26
    tmp28 = tl.broadcast_to(tmp27, [RBLOCK])
    tmp30 = triton_helpers.promote_to_tensor(tl.sum(tmp28, 0))
    tmp32 = tmp31 * tmp1
    tmp33 = tmp32 - tmp4
    tmp34 = tmp33 * tmp33
    tmp35 = tl.broadcast_to(tmp34, [RBLOCK])
    tmp37 = triton_helpers.promote_to_tensor(tl.sum(tmp35, 0))
    tmp39 = tmp38 * tmp1
    tmp40 = tmp39 - tmp4
    tmp41 = tmp40 * tmp40
    tmp42 = tl.broadcast_to(tmp41, [RBLOCK])
    tmp44 = triton_helpers.promote_to_tensor(tl.sum(tmp42, 0))
    tmp47 = tmp45 * tmp46
    tmp49 = tmp48 * tmp46
    tmp50 = tmp47 - tmp49
    tmp51 = tmp50 * tmp50
    tmp52 = tl.broadcast_to(tmp51, [RBLOCK])
    tmp54 = triton_helpers.promote_to_tensor(tl.sum(tmp52, 0))
    tmp56 = tmp55 * tmp46
    tmp57 = tmp56 - tmp49
    tmp58 = tmp57 * tmp57
    tmp59 = tl.broadcast_to(tmp58, [RBLOCK])
    tmp61 = triton_helpers.promote_to_tensor(tl.sum(tmp59, 0))
    tmp63 = tmp62 * tmp46
    tmp64 = tmp63 - tmp49
    tmp65 = tmp64 * tmp64
    tmp66 = tl.broadcast_to(tmp65, [RBLOCK])
    tmp68 = triton_helpers.promote_to_tensor(tl.sum(tmp66, 0))
    tmp70 = tmp69 * tmp46
    tmp71 = tmp70 - tmp49
    tmp72 = tmp71 * tmp71
    tmp73 = tl.broadcast_to(tmp72, [RBLOCK])
    tmp75 = triton_helpers.promote_to_tensor(tl.sum(tmp73, 0))
    tmp77 = tmp76 * tmp46
    tmp78 = tmp77 - tmp49
    tmp79 = tmp78 * tmp78
    tmp80 = tl.broadcast_to(tmp79, [RBLOCK])
    tmp82 = triton_helpers.promote_to_tensor(tl.sum(tmp80, 0))
    tmp84 = tmp83 * tmp46
    tmp85 = tmp84 - tmp49
    tmp86 = tmp85 * tmp85
    tmp87 = tl.broadcast_to(tmp86, [RBLOCK])
    tmp89 = triton_helpers.promote_to_tensor(tl.sum(tmp87, 0))
    tmp90 = 256.0
    tmp91 = tmp9 / tmp90
    tmp92 = tmp54 / tmp90
    tmp93 = tmp91 + tmp92
    tmp94 = 0.0
    tmp95 = tmp93 + tmp94
    tmp96 = tmp16 / tmp90
    tmp97 = tmp61 / tmp90
    tmp98 = tmp96 + tmp97
    tmp99 = tmp95 + tmp98
    tmp100 = tmp23 / tmp90
    tmp101 = tmp68 / tmp90
    tmp102 = tmp100 + tmp101
    tmp103 = tmp99 + tmp102
    tmp104 = tmp30 / tmp90
    tmp105 = tmp75 / tmp90
    tmp106 = tmp104 + tmp105
    tmp107 = tmp103 + tmp106
    tmp108 = tmp37 / tmp90
    tmp109 = tmp82 / tmp90
    tmp110 = tmp108 + tmp109
    tmp111 = tmp107 + tmp110
    tmp112 = tmp44 / tmp90
    tmp113 = tmp89 / tmp90
    tmp114 = tmp112 + tmp113
    tmp115 = tmp111 + tmp114
    tl.debug_barrier()
    tl.store(in_out_ptr0 + tl.full([1], 0, tl.int32), tmp115, None)


def call(args):
    arg0_1, arg1_1, arg2_1, arg3_1, arg4_1 = args
    args.clear()
    assert_size_stride(arg0_1, (12, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(arg1_1, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(arg2_1, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(arg3_1, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(arg4_1, (4, 4, 4, 4), (64, 16, 4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((), (), torch.float32)
        buf10 = buf0
        del buf0
        buf13 = buf10
        del buf10
        get_raw_stream(0)
        triton_per_fused_add_mse_loss_mul_0[grid(1)](buf13, arg0_1, arg1_1,
            arg2_1, arg3_1, arg4_1, 1, 256, num_warps=2, num_stages=1)
        del arg0_1
        del arg1_1
        del arg2_1
        del arg3_1
        del arg4_1
    return buf13,


class OpenPoseLossNew(nn.Module):

    def __init__(self):
        super(OpenPoseLossNew, self).__init__()

    def forward(self, input_0, input_1, input_2, input_3, input_4):
        arg0_1 = input_0
        arg1_1 = input_1
        arg2_1 = input_2
        arg3_1 = input_3
        arg4_1 = input_4
        output = call([arg0_1, arg1_1, arg2_1, arg3_1, arg4_1])
        return output[0]
