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


@triton.jit
def triton_poi_fused_mul_pow_sub_sum_0(in_ptr0, in_ptr1, in_ptr2, 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 = tl.load(in_ptr0 + 0)
    tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
    tmp2 = tl.load(in_ptr1 + 16 * x0, xmask, eviction_policy='evict_last')
    tmp4 = tl.load(in_ptr2 + 0)
    tmp5 = tl.broadcast_to(tmp4, [XBLOCK])
    tmp9 = tl.load(in_ptr0 + 4)
    tmp10 = tl.broadcast_to(tmp9, [XBLOCK])
    tmp11 = tl.load(in_ptr1 + (1 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp13 = tl.load(in_ptr2 + 4)
    tmp14 = tl.broadcast_to(tmp13, [XBLOCK])
    tmp19 = tl.load(in_ptr0 + 8)
    tmp20 = tl.broadcast_to(tmp19, [XBLOCK])
    tmp21 = tl.load(in_ptr1 + (2 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp23 = tl.load(in_ptr2 + 8)
    tmp24 = tl.broadcast_to(tmp23, [XBLOCK])
    tmp29 = tl.load(in_ptr0 + 12)
    tmp30 = tl.broadcast_to(tmp29, [XBLOCK])
    tmp31 = tl.load(in_ptr1 + (3 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp33 = tl.load(in_ptr2 + 12)
    tmp34 = tl.broadcast_to(tmp33, [XBLOCK])
    tmp3 = tmp1 * tmp2
    tmp6 = tmp5 * tmp2
    tmp7 = tmp3 - tmp6
    tmp8 = tmp7 * tmp7
    tmp12 = tmp10 * tmp11
    tmp15 = tmp14 * tmp11
    tmp16 = tmp12 - tmp15
    tmp17 = tmp16 * tmp16
    tmp18 = tmp8 + tmp17
    tmp22 = tmp20 * tmp21
    tmp25 = tmp24 * tmp21
    tmp26 = tmp22 - tmp25
    tmp27 = tmp26 * tmp26
    tmp28 = tmp18 + tmp27
    tmp32 = tmp30 * tmp31
    tmp35 = tmp34 * tmp31
    tmp36 = tmp32 - tmp35
    tmp37 = tmp36 * tmp36
    tmp38 = tmp28 + tmp37
    tl.store(out_ptr0 + x0, tmp38, xmask)


@triton.jit
def triton_poi_fused_mul_pow_sub_sum_1(in_ptr0, in_ptr1, in_ptr2, 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 = tl.load(in_ptr0 + 1)
    tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
    tmp2 = tl.load(in_ptr1 + (4 + 16 * x0), xmask, eviction_policy='evict_last'
        )
    tmp4 = tl.load(in_ptr2 + 1)
    tmp5 = tl.broadcast_to(tmp4, [XBLOCK])
    tmp9 = tl.load(in_ptr0 + 5)
    tmp10 = tl.broadcast_to(tmp9, [XBLOCK])
    tmp11 = tl.load(in_ptr1 + (5 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp13 = tl.load(in_ptr2 + 5)
    tmp14 = tl.broadcast_to(tmp13, [XBLOCK])
    tmp19 = tl.load(in_ptr0 + 9)
    tmp20 = tl.broadcast_to(tmp19, [XBLOCK])
    tmp21 = tl.load(in_ptr1 + (6 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp23 = tl.load(in_ptr2 + 9)
    tmp24 = tl.broadcast_to(tmp23, [XBLOCK])
    tmp29 = tl.load(in_ptr0 + 13)
    tmp30 = tl.broadcast_to(tmp29, [XBLOCK])
    tmp31 = tl.load(in_ptr1 + (7 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp33 = tl.load(in_ptr2 + 13)
    tmp34 = tl.broadcast_to(tmp33, [XBLOCK])
    tmp3 = tmp1 * tmp2
    tmp6 = tmp5 * tmp2
    tmp7 = tmp3 - tmp6
    tmp8 = tmp7 * tmp7
    tmp12 = tmp10 * tmp11
    tmp15 = tmp14 * tmp11
    tmp16 = tmp12 - tmp15
    tmp17 = tmp16 * tmp16
    tmp18 = tmp8 + tmp17
    tmp22 = tmp20 * tmp21
    tmp25 = tmp24 * tmp21
    tmp26 = tmp22 - tmp25
    tmp27 = tmp26 * tmp26
    tmp28 = tmp18 + tmp27
    tmp32 = tmp30 * tmp31
    tmp35 = tmp34 * tmp31
    tmp36 = tmp32 - tmp35
    tmp37 = tmp36 * tmp36
    tmp38 = tmp28 + tmp37
    tl.store(out_ptr0 + x0, tmp38, xmask)


@triton.jit
def triton_poi_fused_mul_pow_sub_sum_2(in_ptr0, in_ptr1, in_ptr2, 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 = tl.load(in_ptr0 + 2)
    tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
    tmp2 = tl.load(in_ptr1 + (8 + 16 * x0), xmask, eviction_policy='evict_last'
        )
    tmp4 = tl.load(in_ptr2 + 2)
    tmp5 = tl.broadcast_to(tmp4, [XBLOCK])
    tmp9 = tl.load(in_ptr0 + 6)
    tmp10 = tl.broadcast_to(tmp9, [XBLOCK])
    tmp11 = tl.load(in_ptr1 + (9 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp13 = tl.load(in_ptr2 + 6)
    tmp14 = tl.broadcast_to(tmp13, [XBLOCK])
    tmp19 = tl.load(in_ptr0 + 10)
    tmp20 = tl.broadcast_to(tmp19, [XBLOCK])
    tmp21 = tl.load(in_ptr1 + (10 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp23 = tl.load(in_ptr2 + 10)
    tmp24 = tl.broadcast_to(tmp23, [XBLOCK])
    tmp29 = tl.load(in_ptr0 + 14)
    tmp30 = tl.broadcast_to(tmp29, [XBLOCK])
    tmp31 = tl.load(in_ptr1 + (11 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp33 = tl.load(in_ptr2 + 14)
    tmp34 = tl.broadcast_to(tmp33, [XBLOCK])
    tmp3 = tmp1 * tmp2
    tmp6 = tmp5 * tmp2
    tmp7 = tmp3 - tmp6
    tmp8 = tmp7 * tmp7
    tmp12 = tmp10 * tmp11
    tmp15 = tmp14 * tmp11
    tmp16 = tmp12 - tmp15
    tmp17 = tmp16 * tmp16
    tmp18 = tmp8 + tmp17
    tmp22 = tmp20 * tmp21
    tmp25 = tmp24 * tmp21
    tmp26 = tmp22 - tmp25
    tmp27 = tmp26 * tmp26
    tmp28 = tmp18 + tmp27
    tmp32 = tmp30 * tmp31
    tmp35 = tmp34 * tmp31
    tmp36 = tmp32 - tmp35
    tmp37 = tmp36 * tmp36
    tmp38 = tmp28 + tmp37
    tl.store(out_ptr0 + x0, tmp38, xmask)


@triton.jit
def triton_poi_fused_mul_pow_sub_sum_3(in_ptr0, in_ptr1, in_ptr2, 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 = tl.load(in_ptr0 + 3)
    tmp1 = tl.broadcast_to(tmp0, [XBLOCK])
    tmp2 = tl.load(in_ptr1 + (12 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp4 = tl.load(in_ptr2 + 3)
    tmp5 = tl.broadcast_to(tmp4, [XBLOCK])
    tmp9 = tl.load(in_ptr0 + 7)
    tmp10 = tl.broadcast_to(tmp9, [XBLOCK])
    tmp11 = tl.load(in_ptr1 + (13 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp13 = tl.load(in_ptr2 + 7)
    tmp14 = tl.broadcast_to(tmp13, [XBLOCK])
    tmp19 = tl.load(in_ptr0 + 11)
    tmp20 = tl.broadcast_to(tmp19, [XBLOCK])
    tmp21 = tl.load(in_ptr1 + (14 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp23 = tl.load(in_ptr2 + 11)
    tmp24 = tl.broadcast_to(tmp23, [XBLOCK])
    tmp29 = tl.load(in_ptr0 + 15)
    tmp30 = tl.broadcast_to(tmp29, [XBLOCK])
    tmp31 = tl.load(in_ptr1 + (15 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp33 = tl.load(in_ptr2 + 15)
    tmp34 = tl.broadcast_to(tmp33, [XBLOCK])
    tmp3 = tmp1 * tmp2
    tmp6 = tmp5 * tmp2
    tmp7 = tmp3 - tmp6
    tmp8 = tmp7 * tmp7
    tmp12 = tmp10 * tmp11
    tmp15 = tmp14 * tmp11
    tmp16 = tmp12 - tmp15
    tmp17 = tmp16 * tmp16
    tmp18 = tmp8 + tmp17
    tmp22 = tmp20 * tmp21
    tmp25 = tmp24 * tmp21
    tmp26 = tmp22 - tmp25
    tmp27 = tmp26 * tmp26
    tmp28 = tmp18 + tmp27
    tmp32 = tmp30 * tmp31
    tmp35 = tmp34 * tmp31
    tmp36 = tmp32 - tmp35
    tmp37 = tmp36 * tmp36
    tmp38 = tmp28 + tmp37
    tl.store(out_ptr0 + x0, tmp38, xmask)


@triton.jit
def triton_poi_fused_cat_4(in_ptr0, in_ptr1, in_ptr2, in_ptr3, out_ptr0,
    xnumel, XBLOCK: tl.constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 4
    x1 = xindex // 4
    x2 = xindex
    tmp0 = x0
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 1, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + x1, tmp4 & xmask, eviction_policy='evict_last',
        other=0.0)
    tmp6 = 0.5
    tmp7 = tmp5 * tmp6
    tmp8 = tl.full(tmp7.shape, 0.0, tmp7.dtype)
    tmp9 = tl.where(tmp4, tmp7, tmp8)
    tmp10 = tmp0 >= tmp3
    tmp11 = tl.full([1], 2, tl.int64)
    tmp12 = tmp0 < tmp11
    tmp13 = tmp10 & tmp12
    tmp14 = tl.load(in_ptr1 + x1, tmp13 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp15 = tmp14 * tmp6
    tmp16 = tl.full(tmp15.shape, 0.0, tmp15.dtype)
    tmp17 = tl.where(tmp13, tmp15, tmp16)
    tmp18 = tmp0 >= tmp11
    tmp19 = tl.full([1], 3, tl.int64)
    tmp20 = tmp0 < tmp19
    tmp21 = tmp18 & tmp20
    tmp22 = tl.load(in_ptr2 + x1, tmp21 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp23 = tmp22 * tmp6
    tmp24 = tl.full(tmp23.shape, 0.0, tmp23.dtype)
    tmp25 = tl.where(tmp21, tmp23, tmp24)
    tmp26 = tmp0 >= tmp19
    tl.full([1], 4, tl.int64)
    tmp29 = tl.load(in_ptr3 + x1, tmp26 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp30 = tmp29 * tmp6
    tmp31 = tl.full(tmp30.shape, 0.0, tmp30.dtype)
    tmp32 = tl.where(tmp26, tmp30, tmp31)
    tmp33 = tl.where(tmp21, tmp25, tmp32)
    tmp34 = tl.where(tmp13, tmp17, tmp33)
    tmp35 = tl.where(tmp4, tmp9, tmp34)
    tl.store(out_ptr0 + x2, tmp35, xmask)


def call(args):
    arg0_1, arg1_1, arg2_1 = args
    args.clear()
    assert_size_stride(arg0_1, (4, 4), (4, 1))
    assert_size_stride(arg1_1, (4, 4), (4, 1))
    assert_size_stride(arg2_1, (4, 4, 4), (16, 4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4,), (1,), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_mul_pow_sub_sum_0[grid(4)](arg0_1, arg2_1, arg1_1,
            buf0, 4, XBLOCK=4, num_warps=1, num_stages=1)
        buf1 = empty_strided_cuda((4,), (1,), torch.float32)
        triton_poi_fused_mul_pow_sub_sum_1[grid(4)](arg0_1, arg2_1, arg1_1,
            buf1, 4, XBLOCK=4, num_warps=1, num_stages=1)
        buf2 = empty_strided_cuda((4,), (1,), torch.float32)
        triton_poi_fused_mul_pow_sub_sum_2[grid(4)](arg0_1, arg2_1, arg1_1,
            buf2, 4, XBLOCK=4, num_warps=1, num_stages=1)
        buf3 = empty_strided_cuda((4,), (1,), torch.float32)
        triton_poi_fused_mul_pow_sub_sum_3[grid(4)](arg0_1, arg2_1, arg1_1,
            buf3, 4, XBLOCK=4, num_warps=1, num_stages=1)
        del arg0_1
        del arg1_1
        del arg2_1
        buf4 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        triton_poi_fused_cat_4[grid(16)](buf0, buf1, buf2, buf3, buf4, 16,
            XBLOCK=16, num_warps=1, num_stages=1)
        del buf0
        del buf1
        del buf2
        del buf3
    return buf4,


class JointsMSELossNoReductionNew(nn.Module):

    def __init__(self, use_target_weight, logger):
        super(JointsMSELossNoReductionNew, self).__init__()
        self.criterion = lambda x, y: ((x - y) ** 2).sum(1).unsqueeze(1)
        self.use_target_weight = use_target_weight
        self.logger = logger

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


Measured latency_ms: 0.073632