# 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/sa/csa4c5dseiw45uchlyc65mbdg6ug55baz4c3axu5v3aq7iwizz3z.py
# Topologically Sorted Source Nodes: [aa, norm, pow_1, neg, div, exp, vaa, bb, norm_1, pow_2, neg_1, div_1, exp_1, vbb, add, ab, norm_2, pow_3, neg_2, div_2, exp_2, vab, mul, loss], Original ATen: [aten.sub, aten.linalg_vector_norm, aten.pow, aten.neg, aten.div, aten.exp, aten.mean, aten.add, aten.mul]
# Source node to ATen node mapping:
#   aa => sub
#   ab => sub_2
#   add => add
#   bb => sub_1
#   div => div
#   div_1 => div_1
#   div_2 => div_2
#   exp => exp
#   exp_1 => exp_1
#   exp_2 => exp_2
#   loss => sub_3
#   mul => mul
#   neg => neg
#   neg_1 => neg_1
#   neg_2 => neg_2
#   norm => pow_1, pow_2, sum_1
#   norm_1 => pow_4, pow_5, sum_2
#   norm_2 => pow_7, pow_8, sum_3
#   pow_1 => pow_3
#   pow_2 => pow_6
#   pow_3 => pow_9
#   vaa => mean
#   vab => mean_2
#   vbb => mean_1
# Graph fragment:
#   %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%view, %view_1), kwargs = {})
#   %pow_1 : [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.dim_IntList](args = (%pow_1, [2]), kwargs = {})
#   %pow_2 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sum_1, 0.5), kwargs = {})
#   %pow_3 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%pow_2, 2), kwargs = {})
#   %neg : [num_users=1] = call_function[target=torch.ops.aten.neg.default](args = (%pow_3,), kwargs = {})
#   %div : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%neg, 16), kwargs = {})
#   %exp : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%div,), kwargs = {})
#   %mean : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%exp,), kwargs = {})
#   %sub_1 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%view_2, %view_3), kwargs = {})
#   %pow_4 : [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.dim_IntList](args = (%pow_4, [2]), kwargs = {})
#   %pow_5 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sum_2, 0.5), kwargs = {})
#   %pow_6 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%pow_5, 2), kwargs = {})
#   %neg_1 : [num_users=1] = call_function[target=torch.ops.aten.neg.default](args = (%pow_6,), kwargs = {})
#   %div_1 : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%neg_1, 16), kwargs = {})
#   %exp_1 : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%div_1,), kwargs = {})
#   %mean_1 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%exp_1,), kwargs = {})
#   %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mean, %mean_1), kwargs = {})
#   %sub_2 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%view, %view_3), kwargs = {})
#   %pow_7 : [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.dim_IntList](args = (%pow_7, [2]), kwargs = {})
#   %pow_8 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sum_3, 0.5), kwargs = {})
#   %pow_9 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%pow_8, 2), kwargs = {})
#   %neg_2 : [num_users=1] = call_function[target=torch.ops.aten.neg.default](args = (%pow_9,), kwargs = {})
#   %div_2 : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%neg_2, 16), kwargs = {})
#   %exp_2 : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%div_2,), kwargs = {})
#   %mean_2 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%exp_2,), kwargs = {})
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mean_2, 2.0), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%add, %mul), kwargs = {})
triton_red_fused_add_div_exp_linalg_vector_norm_mean_mul_neg_pow_sub_0 = async_compile.triton('triton_red_fused_add_div_exp_linalg_vector_norm_mean_mul_neg_pow_sub_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.reduction(
    size_hints=[1, 4096],
    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=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_red_fused_add_div_exp_linalg_vector_norm_mean_mul_neg_pow_sub_0', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 16, 'num_reduction': 3, '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_red_fused_add_div_exp_linalg_vector_norm_mean_mul_neg_pow_sub_0(in_out_ptr0, in_ptr0, in_ptr1, xnumel, rnumel, XBLOCK : tl.constexpr, RBLOCK : tl.constexpr):
    xnumel = 1
    rnumel = 4096
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:, None]
    xmask = tl.full([XBLOCK, RBLOCK], True, tl.int1)
    rbase = tl.arange(0, RBLOCK)[None, :]
    _tmp26 = tl.full([XBLOCK, RBLOCK], 0, tl.float32)
    _tmp53 = tl.full([XBLOCK, RBLOCK], 0, tl.float32)
    _tmp72 = tl.full([XBLOCK, RBLOCK], 0, tl.float32)
    for roffset in range(0, rnumel, RBLOCK):
        rindex = roffset + rbase
        rmask = rindex < rnumel
        r1 = (rindex // 64)
        r0 = rindex % 64
        tmp0 = tl.load(in_ptr0 + (4*r1), rmask, eviction_policy='evict_last', other=0.0)
        tmp1 = tl.load(in_ptr0 + (4*r0), rmask, eviction_policy='evict_last', other=0.0)
        tmp4 = tl.load(in_ptr0 + (1 + (4*r1)), rmask, eviction_policy='evict_last', other=0.0)
        tmp5 = tl.load(in_ptr0 + (1 + (4*r0)), rmask, eviction_policy='evict_last', other=0.0)
        tmp9 = tl.load(in_ptr0 + (2 + (4*r1)), rmask, eviction_policy='evict_last', other=0.0)
        tmp10 = tl.load(in_ptr0 + (2 + (4*r0)), rmask, eviction_policy='evict_last', other=0.0)
        tmp14 = tl.load(in_ptr0 + (3 + (4*r1)), rmask, eviction_policy='evict_last', other=0.0)
        tmp15 = tl.load(in_ptr0 + (3 + (4*r0)), rmask, eviction_policy='evict_last', other=0.0)
        tmp28 = tl.load(in_ptr1 + (4*r1), rmask, eviction_policy='evict_last', other=0.0)
        tmp29 = tl.load(in_ptr1 + (4*r0), rmask, eviction_policy='evict_last', other=0.0)
        tmp32 = tl.load(in_ptr1 + (1 + (4*r1)), rmask, eviction_policy='evict_last', other=0.0)
        tmp33 = tl.load(in_ptr1 + (1 + (4*r0)), rmask, eviction_policy='evict_last', other=0.0)
        tmp37 = tl.load(in_ptr1 + (2 + (4*r1)), rmask, eviction_policy='evict_last', other=0.0)
        tmp38 = tl.load(in_ptr1 + (2 + (4*r0)), rmask, eviction_policy='evict_last', other=0.0)
        tmp42 = tl.load(in_ptr1 + (3 + (4*r1)), rmask, eviction_policy='evict_last', other=0.0)
        tmp43 = tl.load(in_ptr1 + (3 + (4*r0)), rmask, eviction_policy='evict_last', other=0.0)
        tmp2 = tmp0 - tmp1
        tmp3 = tmp2 * tmp2
        tmp6 = tmp4 - tmp5
        tmp7 = tmp6 * tmp6
        tmp8 = tmp3 + tmp7
        tmp11 = tmp9 - tmp10
        tmp12 = tmp11 * tmp11
        tmp13 = tmp8 + tmp12
        tmp16 = tmp14 - tmp15
        tmp17 = tmp16 * tmp16
        tmp18 = tmp13 + tmp17
        tmp19 = libdevice.sqrt(tmp18)
        tmp20 = tmp19 * tmp19
        tmp21 = -tmp20
        tmp22 = 0.0625
        tmp23 = tmp21 * tmp22
        tmp24 = tl_math.exp(tmp23)
        tmp25 = tl.broadcast_to(tmp24, [XBLOCK, RBLOCK])
        tmp27 = _tmp26 + tmp25
        _tmp26 = tl.where(rmask, tmp27, _tmp26)
        tmp30 = tmp28 - tmp29
        tmp31 = tmp30 * tmp30
        tmp34 = tmp32 - tmp33
        tmp35 = tmp34 * tmp34
        tmp36 = tmp31 + tmp35
        tmp39 = tmp37 - tmp38
        tmp40 = tmp39 * tmp39
        tmp41 = tmp36 + tmp40
        tmp44 = tmp42 - tmp43
        tmp45 = tmp44 * tmp44
        tmp46 = tmp41 + tmp45
        tmp47 = libdevice.sqrt(tmp46)
        tmp48 = tmp47 * tmp47
        tmp49 = -tmp48
        tmp50 = tmp49 * tmp22
        tmp51 = tl_math.exp(tmp50)
        tmp52 = tl.broadcast_to(tmp51, [XBLOCK, RBLOCK])
        tmp54 = _tmp53 + tmp52
        _tmp53 = tl.where(rmask, tmp54, _tmp53)
        tmp55 = tmp0 - tmp29
        tmp56 = tmp55 * tmp55
        tmp57 = tmp4 - tmp33
        tmp58 = tmp57 * tmp57
        tmp59 = tmp56 + tmp58
        tmp60 = tmp9 - tmp38
        tmp61 = tmp60 * tmp60
        tmp62 = tmp59 + tmp61
        tmp63 = tmp14 - tmp43
        tmp64 = tmp63 * tmp63
        tmp65 = tmp62 + tmp64
        tmp66 = libdevice.sqrt(tmp65)
        tmp67 = tmp66 * tmp66
        tmp68 = -tmp67
        tmp69 = tmp68 * tmp22
        tmp70 = tl_math.exp(tmp69)
        tmp71 = tl.broadcast_to(tmp70, [XBLOCK, RBLOCK])
        tmp73 = _tmp72 + tmp71
        _tmp72 = tl.where(rmask, tmp73, _tmp72)
    tmp26 = tl.sum(_tmp26, 1)[:, None]
    tmp53 = tl.sum(_tmp53, 1)[:, None]
    tmp72 = tl.sum(_tmp72, 1)[:, None]
    tmp74 = 4096.0
    tmp75 = tmp26 / tmp74
    tmp76 = tmp53 / tmp74
    tmp77 = tmp75 + tmp76
    tmp78 = tmp72 / tmp74
    tmp79 = 2.0
    tmp80 = tmp78 * tmp79
    tmp81 = tmp77 - tmp80
    tl.debug_barrier()
    tl.store(in_out_ptr0 + (tl.full([XBLOCK, 1], 0, tl.int32)), tmp81, 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)
        buf3 = buf0; del buf0  # reuse
        # Topologically Sorted Source Nodes: [aa, norm, pow_1, neg, div, exp, vaa, bb, norm_1, pow_2, neg_1, div_1, exp_1, vbb, add, ab, norm_2, pow_3, neg_2, div_2, exp_2, vab, mul, loss], Original ATen: [aten.sub, aten.linalg_vector_norm, aten.pow, aten.neg, aten.div, aten.exp, aten.mean, aten.add, aten.mul]
        stream0 = get_raw_stream(0)
        triton_red_fused_add_div_exp_linalg_vector_norm_mean_mul_neg_pow_sub_0.run(buf3, arg0_1, arg1_1, 1, 4096, grid=grid(1), stream=stream0)
        del arg0_1
        del arg1_1
    return (buf3, )


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
from torch import nn


class Gaussian_Kernel_Function(nn.Module):

    def __init__(self, std):
        super(Gaussian_Kernel_Function, self).__init__()
        self.sigma = std ** 2

    def forward(self, fa, fb):
        asize = fa.size()
        bsize = fb.size()
        fa1 = fa.view(-1, 1, asize[1])
        fa2 = fa.view(1, -1, asize[1])
        fb1 = fb.view(-1, 1, bsize[1])
        fb2 = fb.view(1, -1, bsize[1])
        aa = fa1 - fa2
        vaa = torch.mean(torch.exp(torch.div(-torch.pow(torch.norm(aa, 2,
            dim=2), 2), self.sigma)))
        bb = fb1 - fb2
        vbb = torch.mean(torch.exp(torch.div(-torch.pow(torch.norm(bb, 2,
            dim=2), 2), self.sigma)))
        ab = fa1 - fb2
        vab = torch.mean(torch.exp(torch.div(-torch.pow(torch.norm(ab, 2,
            dim=2), 2), self.sigma)))
        loss = vaa + vbb - 2.0 * vab
        return loss


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


def get_init_inputs():
    return [[], {'std': 4}]

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, math as tl_math
from torch import 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_red_fused_add_div_exp_linalg_vector_norm_mean_mul_neg_pow_sub_0(
    in_out_ptr0, in_ptr0, in_ptr1, xnumel, rnumel, XBLOCK: tl.constexpr,
    RBLOCK: tl.constexpr):
    rnumel = 4096
    xoffset = tl.program_id(0) * XBLOCK
    xoffset + tl.arange(0, XBLOCK)[:, None]
    tl.full([XBLOCK, RBLOCK], True, tl.int1)
    rbase = tl.arange(0, RBLOCK)[None, :]
    _tmp26 = tl.full([XBLOCK, RBLOCK], 0, tl.float32)
    _tmp53 = tl.full([XBLOCK, RBLOCK], 0, tl.float32)
    _tmp72 = tl.full([XBLOCK, RBLOCK], 0, tl.float32)
    for roffset in range(0, rnumel, RBLOCK):
        rindex = roffset + rbase
        rmask = rindex < rnumel
        r1 = rindex // 64
        r0 = rindex % 64
        tmp0 = tl.load(in_ptr0 + 4 * r1, rmask, eviction_policy=
            'evict_last', other=0.0)
        tmp1 = tl.load(in_ptr0 + 4 * r0, rmask, eviction_policy=
            'evict_last', other=0.0)
        tmp4 = tl.load(in_ptr0 + (1 + 4 * r1), rmask, eviction_policy=
            'evict_last', other=0.0)
        tmp5 = tl.load(in_ptr0 + (1 + 4 * r0), rmask, eviction_policy=
            'evict_last', other=0.0)
        tmp9 = tl.load(in_ptr0 + (2 + 4 * r1), rmask, eviction_policy=
            'evict_last', other=0.0)
        tmp10 = tl.load(in_ptr0 + (2 + 4 * r0), rmask, eviction_policy=
            'evict_last', other=0.0)
        tmp14 = tl.load(in_ptr0 + (3 + 4 * r1), rmask, eviction_policy=
            'evict_last', other=0.0)
        tmp15 = tl.load(in_ptr0 + (3 + 4 * r0), rmask, eviction_policy=
            'evict_last', other=0.0)
        tmp28 = tl.load(in_ptr1 + 4 * r1, rmask, eviction_policy=
            'evict_last', other=0.0)
        tmp29 = tl.load(in_ptr1 + 4 * r0, rmask, eviction_policy=
            'evict_last', other=0.0)
        tmp32 = tl.load(in_ptr1 + (1 + 4 * r1), rmask, eviction_policy=
            'evict_last', other=0.0)
        tmp33 = tl.load(in_ptr1 + (1 + 4 * r0), rmask, eviction_policy=
            'evict_last', other=0.0)
        tmp37 = tl.load(in_ptr1 + (2 + 4 * r1), rmask, eviction_policy=
            'evict_last', other=0.0)
        tmp38 = tl.load(in_ptr1 + (2 + 4 * r0), rmask, eviction_policy=
            'evict_last', other=0.0)
        tmp42 = tl.load(in_ptr1 + (3 + 4 * r1), rmask, eviction_policy=
            'evict_last', other=0.0)
        tmp43 = tl.load(in_ptr1 + (3 + 4 * r0), rmask, eviction_policy=
            'evict_last', other=0.0)
        tmp2 = tmp0 - tmp1
        tmp3 = tmp2 * tmp2
        tmp6 = tmp4 - tmp5
        tmp7 = tmp6 * tmp6
        tmp8 = tmp3 + tmp7
        tmp11 = tmp9 - tmp10
        tmp12 = tmp11 * tmp11
        tmp13 = tmp8 + tmp12
        tmp16 = tmp14 - tmp15
        tmp17 = tmp16 * tmp16
        tmp18 = tmp13 + tmp17
        tmp19 = libdevice.sqrt(tmp18)
        tmp20 = tmp19 * tmp19
        tmp21 = -tmp20
        tmp22 = 0.0625
        tmp23 = tmp21 * tmp22
        tmp24 = tl_math.exp(tmp23)
        tmp25 = tl.broadcast_to(tmp24, [XBLOCK, RBLOCK])
        tmp27 = _tmp26 + tmp25
        _tmp26 = tl.where(rmask, tmp27, _tmp26)
        tmp30 = tmp28 - tmp29
        tmp31 = tmp30 * tmp30
        tmp34 = tmp32 - tmp33
        tmp35 = tmp34 * tmp34
        tmp36 = tmp31 + tmp35
        tmp39 = tmp37 - tmp38
        tmp40 = tmp39 * tmp39
        tmp41 = tmp36 + tmp40
        tmp44 = tmp42 - tmp43
        tmp45 = tmp44 * tmp44
        tmp46 = tmp41 + tmp45
        tmp47 = libdevice.sqrt(tmp46)
        tmp48 = tmp47 * tmp47
        tmp49 = -tmp48
        tmp50 = tmp49 * tmp22
        tmp51 = tl_math.exp(tmp50)
        tmp52 = tl.broadcast_to(tmp51, [XBLOCK, RBLOCK])
        tmp54 = _tmp53 + tmp52
        _tmp53 = tl.where(rmask, tmp54, _tmp53)
        tmp55 = tmp0 - tmp29
        tmp56 = tmp55 * tmp55
        tmp57 = tmp4 - tmp33
        tmp58 = tmp57 * tmp57
        tmp59 = tmp56 + tmp58
        tmp60 = tmp9 - tmp38
        tmp61 = tmp60 * tmp60
        tmp62 = tmp59 + tmp61
        tmp63 = tmp14 - tmp43
        tmp64 = tmp63 * tmp63
        tmp65 = tmp62 + tmp64
        tmp66 = libdevice.sqrt(tmp65)
        tmp67 = tmp66 * tmp66
        tmp68 = -tmp67
        tmp69 = tmp68 * tmp22
        tmp70 = tl_math.exp(tmp69)
        tmp71 = tl.broadcast_to(tmp70, [XBLOCK, RBLOCK])
        tmp73 = _tmp72 + tmp71
        _tmp72 = tl.where(rmask, tmp73, _tmp72)
    tmp26 = tl.sum(_tmp26, 1)[:, None]
    tmp53 = tl.sum(_tmp53, 1)[:, None]
    tmp72 = tl.sum(_tmp72, 1)[:, None]
    tmp74 = 4096.0
    tmp75 = tmp26 / tmp74
    tmp76 = tmp53 / tmp74
    tmp77 = tmp75 + tmp76
    tmp78 = tmp72 / tmp74
    tmp79 = 2.0
    tmp80 = tmp78 * tmp79
    tmp81 = tmp77 - tmp80
    tl.debug_barrier()
    tl.store(in_out_ptr0 + tl.full([XBLOCK, 1], 0, tl.int32), tmp81, 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)
        buf3 = buf0
        del buf0
        get_raw_stream(0)
        triton_red_fused_add_div_exp_linalg_vector_norm_mean_mul_neg_pow_sub_0[
            grid(1)](buf3, arg0_1, arg1_1, 1, 4096, XBLOCK=1, RBLOCK=2048,
            num_warps=16, num_stages=1)
        del arg0_1
        del arg1_1
    return buf3,


class Gaussian_Kernel_FunctionNew(nn.Module):

    def __init__(self, std):
        super(Gaussian_Kernel_FunctionNew, self).__init__()
        self.sigma = std ** 2

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