# 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_6/inductor_cache/72/c72g2dvoapyu2w3btvcwvybzkkejuwimtnkqu2eftrh44dy2keia.py
# Topologically Sorted Source Nodes: [f1_k, f2_k, sub, pow_3, sum_1, add, sqrt, loss, pow_4, f1_k_1, pow_5, f2_k_1, sub_1, pow_6, sum_2, add_2, sqrt_1, loss_1, pow_7, f1_k_2, pow_8, f2_k_2, sub_2, pow_9, sum_3, add_3, sqrt_2, loss_2, pow_10, f1_k_3, pow_11, f2_k_3, sub_3, pow_12, sum_4, add_4, sqrt_3, loss_3], Original ATen: [aten.mean, aten.sub, aten.pow, aten.sum, aten.add, aten.sqrt]
# Source node to ATen node mapping:
#   add => add
#   add_2 => add_2
#   add_3 => add_4
#   add_4 => add_6
#   f1_k => mean
#   f1_k_1 => mean_2
#   f1_k_2 => mean_4
#   f1_k_3 => mean_6
#   f2_k => mean_1
#   f2_k_1 => mean_3
#   f2_k_2 => mean_5
#   f2_k_3 => mean_7
#   loss => add_1
#   loss_1 => add_3
#   loss_2 => add_5
#   loss_3 => add_7
#   pow_10 => pow_10
#   pow_11 => pow_11
#   pow_12 => pow_12
#   pow_3 => pow_3
#   pow_4 => pow_4
#   pow_5 => pow_5
#   pow_6 => pow_6
#   pow_7 => pow_7
#   pow_8 => pow_8
#   pow_9 => pow_9
#   sqrt => sqrt
#   sqrt_1 => sqrt_1
#   sqrt_2 => sqrt_2
#   sqrt_3 => sqrt_3
#   sub => sub
#   sub_1 => sub_1
#   sub_2 => sub_2
#   sub_3 => sub_3
#   sum_1 => sum_1
#   sum_2 => sum_2
#   sum_3 => sum_3
#   sum_4 => sum_4
# Graph fragment:
#   %mean : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%arg0_1, [0]), kwargs = {})
#   %mean_1 : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%arg1_1, [0]), kwargs = {})
#   %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mean, %mean_1), kwargs = {})
#   %pow_3 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub, 2), kwargs = {})
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%pow_3,), kwargs = {})
#   %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%sum_1, 1e-08), kwargs = {})
#   %sqrt : [num_users=1] = call_function[target=torch.ops.aten.sqrt.default](args = (%add,), kwargs = {})
#   %add_1 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%sqrt, 0.0), kwargs = {})
#   %pow_4 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%arg0_1, 2), kwargs = {})
#   %mean_2 : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%pow_4, [0]), kwargs = {})
#   %pow_5 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%arg1_1, 2), kwargs = {})
#   %mean_3 : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%pow_5, [0]), kwargs = {})
#   %sub_1 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mean_2, %mean_3), kwargs = {})
#   %pow_6 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_1, 2), kwargs = {})
#   %sum_2 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%pow_6,), kwargs = {})
#   %add_2 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%sum_2, 1e-08), kwargs = {})
#   %sqrt_1 : [num_users=1] = call_function[target=torch.ops.aten.sqrt.default](args = (%add_2,), kwargs = {})
#   %add_3 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_1, %sqrt_1), kwargs = {})
#   %pow_7 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%arg0_1, 3), kwargs = {})
#   %mean_4 : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%pow_7, [0]), kwargs = {})
#   %pow_8 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%arg1_1, 3), kwargs = {})
#   %mean_5 : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%pow_8, [0]), kwargs = {})
#   %sub_2 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mean_4, %mean_5), kwargs = {})
#   %pow_9 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_2, 2), kwargs = {})
#   %sum_3 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%pow_9,), kwargs = {})
#   %add_4 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%sum_3, 1e-08), kwargs = {})
#   %sqrt_2 : [num_users=1] = call_function[target=torch.ops.aten.sqrt.default](args = (%add_4,), kwargs = {})
#   %add_5 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_3, %sqrt_2), kwargs = {})
#   %pow_10 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%arg0_1, 4), kwargs = {})
#   %mean_6 : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%pow_10, [0]), kwargs = {})
#   %pow_11 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%arg1_1, 4), kwargs = {})
#   %mean_7 : [num_users=1] = call_function[target=torch.ops.aten.mean.dim](args = (%pow_11, [0]), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mean_6, %mean_7), kwargs = {})
#   %pow_12 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_3, 2), kwargs = {})
#   %sum_4 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%pow_12,), kwargs = {})
#   %add_6 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%sum_4, 1e-08), kwargs = {})
#   %sqrt_3 : [num_users=1] = call_function[target=torch.ops.aten.sqrt.default](args = (%add_6,), kwargs = {})
#   %add_7 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_5, %sqrt_3), kwargs = {})
triton_per_fused_add_mean_pow_sqrt_sub_sum_0 = async_compile.triton('triton_per_fused_add_mean_pow_sqrt_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, 64],
    reduction_hint=ReductionHint.INNER,
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: 'i32', 4: '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': {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_mean_pow_sqrt_sub_sum_0', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 8, 'num_reduction': 4, '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_mean_pow_sqrt_sub_sum_0(in_out_ptr0, in_ptr0, in_ptr1, xnumel, rnumel, XBLOCK : tl.constexpr):
    xnumel = 1
    rnumel = 64
    RBLOCK: tl.constexpr = 64
    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 + (r0), None)
    tmp1 = tl.load(in_ptr0 + (64 + r0), None)
    tmp3 = tl.load(in_ptr0 + (128 + r0), None)
    tmp5 = tl.load(in_ptr0 + (192 + r0), None)
    tmp9 = tl.load(in_ptr1 + (r0), None)
    tmp10 = tl.load(in_ptr1 + (64 + r0), None)
    tmp12 = tl.load(in_ptr1 + (128 + r0), None)
    tmp14 = tl.load(in_ptr1 + (192 + r0), None)
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tmp6 = tmp4 + tmp5
    tmp7 = 4.0
    tmp8 = tmp6 / tmp7
    tmp11 = tmp9 + tmp10
    tmp13 = tmp11 + tmp12
    tmp15 = tmp13 + tmp14
    tmp16 = tmp15 / tmp7
    tmp17 = tmp8 - tmp16
    tmp18 = tmp17 * tmp17
    tmp19 = tl.broadcast_to(tmp18, [XBLOCK, RBLOCK])
    tmp21 = tl.sum(tmp19, 1)[:, None]
    tmp22 = tmp0 * tmp0
    tmp23 = tmp1 * tmp1
    tmp24 = tmp22 + tmp23
    tmp25 = tmp3 * tmp3
    tmp26 = tmp24 + tmp25
    tmp27 = tmp5 * tmp5
    tmp28 = tmp26 + tmp27
    tmp29 = tmp28 / tmp7
    tmp30 = tmp9 * tmp9
    tmp31 = tmp10 * tmp10
    tmp32 = tmp30 + tmp31
    tmp33 = tmp12 * tmp12
    tmp34 = tmp32 + tmp33
    tmp35 = tmp14 * tmp14
    tmp36 = tmp34 + tmp35
    tmp37 = tmp36 / tmp7
    tmp38 = tmp29 - tmp37
    tmp39 = tmp38 * tmp38
    tmp40 = tl.broadcast_to(tmp39, [XBLOCK, RBLOCK])
    tmp42 = tl.sum(tmp40, 1)[:, None]
    tmp43 = tmp22 * tmp0
    tmp44 = tmp23 * tmp1
    tmp45 = tmp43 + tmp44
    tmp46 = tmp25 * tmp3
    tmp47 = tmp45 + tmp46
    tmp48 = tmp27 * tmp5
    tmp49 = tmp47 + tmp48
    tmp50 = tmp49 / tmp7
    tmp51 = tmp30 * tmp9
    tmp52 = tmp31 * tmp10
    tmp53 = tmp51 + tmp52
    tmp54 = tmp33 * tmp12
    tmp55 = tmp53 + tmp54
    tmp56 = tmp35 * tmp14
    tmp57 = tmp55 + tmp56
    tmp58 = tmp57 / tmp7
    tmp59 = tmp50 - tmp58
    tmp60 = tmp22 * tmp22
    tmp61 = tmp23 * tmp23
    tmp62 = tmp60 + tmp61
    tmp63 = tmp25 * tmp25
    tmp64 = tmp62 + tmp63
    tmp65 = tmp27 * tmp27
    tmp66 = tmp64 + tmp65
    tmp67 = tmp66 / tmp7
    tmp68 = tmp30 * tmp30
    tmp69 = tmp31 * tmp31
    tmp70 = tmp68 + tmp69
    tmp71 = tmp33 * tmp33
    tmp72 = tmp70 + tmp71
    tmp73 = tmp35 * tmp35
    tmp74 = tmp72 + tmp73
    tmp75 = tmp74 / tmp7
    tmp76 = tmp67 - tmp75
    tmp77 = tmp59 * tmp59
    tmp78 = tl.broadcast_to(tmp77, [XBLOCK, RBLOCK])
    tmp80 = tl.sum(tmp78, 1)[:, None]
    tmp81 = tmp76 * tmp76
    tmp82 = tl.broadcast_to(tmp81, [XBLOCK, RBLOCK])
    tmp84 = tl.sum(tmp82, 1)[:, None]
    tmp85 = 1e-08
    tmp86 = tmp21 + tmp85
    tmp87 = libdevice.sqrt(tmp86)
    tmp88 = 0.0
    tmp89 = tmp87 + tmp88
    tmp90 = tmp42 + tmp85
    tmp91 = libdevice.sqrt(tmp90)
    tmp92 = tmp89 + tmp91
    tmp93 = tmp80 + tmp85
    tmp94 = libdevice.sqrt(tmp93)
    tmp95 = tmp92 + tmp94
    tmp96 = tmp84 + tmp85
    tmp97 = libdevice.sqrt(tmp96)
    tmp98 = tmp95 + tmp97
    tl.debug_barrier()
    tl.store(in_out_ptr0 + (tl.full([XBLOCK, 1], 0, tl.int32)), tmp98, 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)
        buf0 = empty_strided_cuda((), (), torch.float32)
        buf6 = buf0; del buf0  # reuse
        # Topologically Sorted Source Nodes: [f1_k, f2_k, sub, pow_3, sum_1, add, sqrt, loss, pow_4, f1_k_1, pow_5, f2_k_1, sub_1, pow_6, sum_2, add_2, sqrt_1, loss_1, pow_7, f1_k_2, pow_8, f2_k_2, sub_2, pow_9, sum_3, add_3, sqrt_2, loss_2, pow_10, f1_k_3, pow_11, f2_k_3, sub_3, pow_12, sum_4, add_4, sqrt_3, loss_3], Original ATen: [aten.mean, aten.sub, aten.pow, aten.sum, aten.add, aten.sqrt]
        stream0 = get_raw_stream(0)
        triton_per_fused_add_mean_pow_sqrt_sub_sum_0.run(buf6, arg0_1, arg1_1, 1, 64, grid=grid(1), stream=stream0)
        del arg0_1
        del arg1_1
    return (buf6, )


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.optim
import torch.nn as nn


class KMomentLoss(nn.Module):

    def __init__(self, k: 'int'=4):
        """
        k moment distance, where `k` represents the highest order of moment.
        """
        super(KMomentLoss, self).__init__()
        self.eps = 1e-08
        self.k = k

    def euclidean_dist(self, d1: 'torch.Tensor', d2: 'torch.Tensor'
        ) ->torch.Tensor:
        return (((d1 - d2) ** 2).sum() + self.eps).sqrt()

    def forward(self, f1: 'torch.Tensor', f2: 'torch.Tensor') ->torch.Tensor:
        loss = 0.0
        for order in range(1, self.k + 1):
            f1_k = (f1 ** order).mean(dim=0)
            f2_k = (f2 ** order).mean(dim=0)
            loss += self.euclidean_dist(f1_k, f2_k)
        return loss


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
from torch._inductor.runtime.triton_helpers import libdevice
import torch.optim
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_mean_pow_sqrt_sub_sum_0(in_out_ptr0, in_ptr0,
    in_ptr1, xnumel, rnumel, XBLOCK: tl.constexpr):
    RBLOCK: tl.constexpr = 64
    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 + r0, None)
    tmp1 = tl.load(in_ptr0 + (64 + r0), None)
    tmp3 = tl.load(in_ptr0 + (128 + r0), None)
    tmp5 = tl.load(in_ptr0 + (192 + r0), None)
    tmp9 = tl.load(in_ptr1 + r0, None)
    tmp10 = tl.load(in_ptr1 + (64 + r0), None)
    tmp12 = tl.load(in_ptr1 + (128 + r0), None)
    tmp14 = tl.load(in_ptr1 + (192 + r0), None)
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tmp6 = tmp4 + tmp5
    tmp7 = 4.0
    tmp8 = tmp6 / tmp7
    tmp11 = tmp9 + tmp10
    tmp13 = tmp11 + tmp12
    tmp15 = tmp13 + tmp14
    tmp16 = tmp15 / tmp7
    tmp17 = tmp8 - tmp16
    tmp18 = tmp17 * tmp17
    tmp19 = tl.broadcast_to(tmp18, [XBLOCK, RBLOCK])
    tmp21 = tl.sum(tmp19, 1)[:, None]
    tmp22 = tmp0 * tmp0
    tmp23 = tmp1 * tmp1
    tmp24 = tmp22 + tmp23
    tmp25 = tmp3 * tmp3
    tmp26 = tmp24 + tmp25
    tmp27 = tmp5 * tmp5
    tmp28 = tmp26 + tmp27
    tmp29 = tmp28 / tmp7
    tmp30 = tmp9 * tmp9
    tmp31 = tmp10 * tmp10
    tmp32 = tmp30 + tmp31
    tmp33 = tmp12 * tmp12
    tmp34 = tmp32 + tmp33
    tmp35 = tmp14 * tmp14
    tmp36 = tmp34 + tmp35
    tmp37 = tmp36 / tmp7
    tmp38 = tmp29 - tmp37
    tmp39 = tmp38 * tmp38
    tmp40 = tl.broadcast_to(tmp39, [XBLOCK, RBLOCK])
    tmp42 = tl.sum(tmp40, 1)[:, None]
    tmp43 = tmp22 * tmp0
    tmp44 = tmp23 * tmp1
    tmp45 = tmp43 + tmp44
    tmp46 = tmp25 * tmp3
    tmp47 = tmp45 + tmp46
    tmp48 = tmp27 * tmp5
    tmp49 = tmp47 + tmp48
    tmp50 = tmp49 / tmp7
    tmp51 = tmp30 * tmp9
    tmp52 = tmp31 * tmp10
    tmp53 = tmp51 + tmp52
    tmp54 = tmp33 * tmp12
    tmp55 = tmp53 + tmp54
    tmp56 = tmp35 * tmp14
    tmp57 = tmp55 + tmp56
    tmp58 = tmp57 / tmp7
    tmp59 = tmp50 - tmp58
    tmp60 = tmp22 * tmp22
    tmp61 = tmp23 * tmp23
    tmp62 = tmp60 + tmp61
    tmp63 = tmp25 * tmp25
    tmp64 = tmp62 + tmp63
    tmp65 = tmp27 * tmp27
    tmp66 = tmp64 + tmp65
    tmp67 = tmp66 / tmp7
    tmp68 = tmp30 * tmp30
    tmp69 = tmp31 * tmp31
    tmp70 = tmp68 + tmp69
    tmp71 = tmp33 * tmp33
    tmp72 = tmp70 + tmp71
    tmp73 = tmp35 * tmp35
    tmp74 = tmp72 + tmp73
    tmp75 = tmp74 / tmp7
    tmp76 = tmp67 - tmp75
    tmp77 = tmp59 * tmp59
    tmp78 = tl.broadcast_to(tmp77, [XBLOCK, RBLOCK])
    tmp80 = tl.sum(tmp78, 1)[:, None]
    tmp81 = tmp76 * tmp76
    tmp82 = tl.broadcast_to(tmp81, [XBLOCK, RBLOCK])
    tmp84 = tl.sum(tmp82, 1)[:, None]
    tmp85 = 1e-08
    tmp86 = tmp21 + tmp85
    tmp87 = libdevice.sqrt(tmp86)
    tmp88 = 0.0
    tmp89 = tmp87 + tmp88
    tmp90 = tmp42 + tmp85
    tmp91 = libdevice.sqrt(tmp90)
    tmp92 = tmp89 + tmp91
    tmp93 = tmp80 + tmp85
    tmp94 = libdevice.sqrt(tmp93)
    tmp95 = tmp92 + tmp94
    tmp96 = tmp84 + tmp85
    tmp97 = libdevice.sqrt(tmp96)
    tmp98 = tmp95 + tmp97
    tl.debug_barrier()
    tl.store(in_out_ptr0 + tl.full([XBLOCK, 1], 0, tl.int32), tmp98, 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)
        buf0 = empty_strided_cuda((), (), torch.float32)
        buf6 = buf0
        del buf0
        get_raw_stream(0)
        triton_per_fused_add_mean_pow_sqrt_sub_sum_0[grid(1)](buf6, arg0_1,
            arg1_1, 1, 64, XBLOCK=1, num_warps=2, num_stages=1)
        del arg0_1
        del arg1_1
    return buf6,


class KMomentLossNew(nn.Module):

    def __init__(self, k: 'int'=4):
        """
        k moment distance, where `k` represents the highest order of moment.
        """
        super(KMomentLossNew, self).__init__()
        self.eps = 1e-08
        self.k = k

    def euclidean_dist(self, d1: 'torch.Tensor', d2: 'torch.Tensor'
        ) ->torch.Tensor:
        return (((d1 - d2) ** 2).sum() + self.eps).sqrt()

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