# 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/qz/cqza6p5fjiie2hfiu5dfjqqugrnzziwuwxzlhzy2aa7khopxjbym.py
# Topologically Sorted Source Nodes: [y_pred], Original ATen: [aten._softmax]
# Source node to ATen node mapping:
#   y_pred => amax, exp, sub
# Graph fragment:
#   %amax : [num_users=1] = call_function[target=torch.ops.aten.amax.default](args = (%arg0_1, [1], True), kwargs = {})
#   %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, %amax), kwargs = {})
#   %exp : [num_users=2] = call_function[target=torch.ops.aten.exp.default](args = (%sub,), kwargs = {})
triton_poi_fused__softmax_0 = async_compile.triton('triton_poi_fused__softmax_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.pointwise(
    size_hints=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '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': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused__softmax_0', 'mutated_arg_names': [], 'no_x_dim': False, 'num_load': 5, 'num_reduction': 0, '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},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused__softmax_0(in_ptr0, out_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x0 = xindex % 16
    x2 = (xindex // 64)
    tmp0 = tl.load(in_ptr0 + (x3), xmask)
    tmp1 = tl.load(in_ptr0 + (x0 + (64*x2)), xmask, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr0 + (16 + x0 + (64*x2)), xmask, eviction_policy='evict_last')
    tmp4 = tl.load(in_ptr0 + (32 + x0 + (64*x2)), xmask, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr0 + (48 + x0 + (64*x2)), xmask, eviction_policy='evict_last')
    tmp3 = triton_helpers.maximum(tmp1, tmp2)
    tmp5 = triton_helpers.maximum(tmp3, tmp4)
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp0 - tmp7
    tmp9 = tl_math.exp(tmp8)
    tl.store(out_ptr0 + (x3), tmp9, xmask)
''', device_str='cuda')


# kernel path: runs/run_shard_6/inductor_cache/2a/c2apsa6r2m5mgygtja7ypqpxhpjadp2gvrgah55ewrisisoublwc.py
# Topologically Sorted Source Nodes: [mean_2, vx, y_pred, mean_3, vy, mul, sum_1, pow_1, sum_2, add, sqrt, pow_2, sum_3, add_1, sqrt_1, mul_1, pcc, mul_2, y_true_std, mul_3, y_pred_std, mul_4, y_true_var, y_pred_var, add_2, y_pred_mean, y_true_mean, sub_2, pow_3, add_3, ccc, ccc_1, mul_5], Original ATen: [aten.mean, aten.sub, aten._softmax, aten.mul, aten.sum, aten.pow, aten.add, aten.sqrt, aten.div, aten.std, aten.var, aten.rsub]
# Source node to ATen node mapping:
#   add => add
#   add_1 => add_1
#   add_2 => add_2
#   add_3 => add_3
#   ccc => div_2
#   ccc_1 => sub_4
#   mean_2 => mean_2
#   mean_3 => mean_3
#   mul => mul
#   mul_1 => mul_1
#   mul_2 => mul_2
#   mul_3 => mul_3
#   mul_4 => mul_4
#   mul_5 => mul_5
#   pcc => div_1
#   pow_1 => pow_1
#   pow_2 => pow_2
#   pow_3 => pow_3
#   sqrt => sqrt_2
#   sqrt_1 => sqrt_3
#   sub_2 => sub_3
#   sum_1 => sum_2
#   sum_2 => sum_3
#   sum_3 => sum_4
#   vx => sub_1
#   vy => sub_2
#   y_pred => div, sum_1
#   y_pred_mean => mean_1
#   y_pred_std => sqrt_1, var_3
#   y_pred_var => var_1
#   y_true_mean => mean
#   y_true_std => sqrt, var_2
#   y_true_var => var
# Graph fragment:
#   %mean_2 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%arg1_1,), kwargs = {})
#   %sub_1 : [num_users=2] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg1_1, %mean_2), kwargs = {})
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%exp, [1], True), kwargs = {})
#   %div : [num_users=5] = call_function[target=torch.ops.aten.div.Tensor](args = (%exp, %sum_1), kwargs = {})
#   %mean_3 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%div,), kwargs = {})
#   %sub_2 : [num_users=2] = call_function[target=torch.ops.aten.sub.Tensor](args = (%div, %mean_3), kwargs = {})
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_1, %sub_2), kwargs = {})
#   %sum_2 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%mul,), kwargs = {})
#   %pow_1 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_1, 2), kwargs = {})
#   %sum_3 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%pow_1,), kwargs = {})
#   %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%sum_3, 1e-06), kwargs = {})
#   %sqrt_2 : [num_users=1] = call_function[target=torch.ops.aten.sqrt.default](args = (%add,), kwargs = {})
#   %pow_2 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_2, 2), kwargs = {})
#   %sum_4 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%pow_2,), kwargs = {})
#   %add_1 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%sum_4, 1e-06), kwargs = {})
#   %sqrt_3 : [num_users=1] = call_function[target=torch.ops.aten.sqrt.default](args = (%add_1,), kwargs = {})
#   %mul_1 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sqrt_2, %sqrt_3), kwargs = {})
#   %div_1 : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%sum_2, %mul_1), kwargs = {})
#   %mul_2 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%div_1, 2), kwargs = {})
#   %var_2 : [num_users=1] = call_function[target=torch.ops.aten.var.correction](args = (%arg1_1,), kwargs = {correction: 1.0})
#   %sqrt : [num_users=1] = call_function[target=torch.ops.aten.sqrt.default](args = (%var_2,), kwargs = {})
#   %mul_3 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_2, %sqrt), kwargs = {})
#   %var_3 : [num_users=1] = call_function[target=torch.ops.aten.var.correction](args = (%div,), kwargs = {correction: 1.0})
#   %sqrt_1 : [num_users=1] = call_function[target=torch.ops.aten.sqrt.default](args = (%var_3,), kwargs = {})
#   %mul_4 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_3, %sqrt_1), kwargs = {})
#   %var : [num_users=1] = call_function[target=torch.ops.aten.var.correction](args = (%arg1_1,), kwargs = {})
#   %var_1 : [num_users=1] = call_function[target=torch.ops.aten.var.correction](args = (%div,), kwargs = {})
#   %add_2 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%var, %var_1), kwargs = {})
#   %mean_1 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%div,), kwargs = {})
#   %mean : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%arg1_1,), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mean_1, %mean), kwargs = {})
#   %pow_3 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%sub_3, 2), kwargs = {})
#   %add_3 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_2, %pow_3), kwargs = {})
#   %div_2 : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%mul_4, %add_3), kwargs = {})
#   %sub_4 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (1, %div_2), kwargs = {})
#   %mul_5 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_4, 10), kwargs = {})
triton_per_fused__softmax_add_div_mean_mul_pow_rsub_sqrt_std_sub_sum_var_1 = async_compile.triton('triton_per_fused__softmax_add_div_mean_mul_pow_rsub_sqrt_std_sub_sum_var_1', '''
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: 'i32', 5: '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': {4: 1}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 5), equal_to_1=(4,))]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_per_fused__softmax_add_div_mean_mul_pow_rsub_sqrt_std_sub_sum_var_1', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': True, 'num_load': 6, 'num_reduction': 15, '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__softmax_add_div_mean_mul_pow_rsub_sqrt_std_sub_sum_var_1(in_out_ptr0, in_ptr0, in_ptr1, out_ptr0, 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)
    r3 = rindex
    r0 = rindex % 16
    r2 = (rindex // 64)
    tmp0 = tl.load(in_ptr0 + (r3), None)
    tmp1 = tl.load(in_ptr0 + (r0 + (64*r2)), None, eviction_policy='evict_last')
    tmp2 = tl.load(in_ptr0 + (16 + r0 + (64*r2)), None, eviction_policy='evict_last')
    tmp4 = tl.load(in_ptr0 + (32 + r0 + (64*r2)), None, eviction_policy='evict_last')
    tmp6 = tl.load(in_ptr0 + (48 + r0 + (64*r2)), None, eviction_policy='evict_last')
    tmp9 = tl.load(in_ptr1 + (r3), None)
    tmp3 = tmp1 + tmp2
    tmp5 = tmp3 + tmp4
    tmp7 = tmp5 + tmp6
    tmp8 = tmp0 / tmp7
    tmp10 = tl.broadcast_to(tmp9, [RBLOCK])
    tmp12 = triton_helpers.promote_to_tensor(tl.sum(tmp10, 0))
    tmp13 = tl.broadcast_to(tmp8, [RBLOCK])
    tmp15 = triton_helpers.promote_to_tensor(tl.sum(tmp13, 0))
    tmp16 = 256.0
    tmp17 = tmp12 / tmp16
    tmp18 = tmp9 - tmp17
    tmp19 = tmp15 / tmp16
    tmp20 = tmp8 - tmp19
    tmp21 = tmp18 * tmp20
    tmp22 = tl.broadcast_to(tmp21, [RBLOCK])
    tmp24 = triton_helpers.promote_to_tensor(tl.sum(tmp22, 0))
    tmp25 = tmp18 * tmp18
    tmp26 = tl.broadcast_to(tmp25, [RBLOCK])
    tmp28 = triton_helpers.promote_to_tensor(tl.sum(tmp26, 0))
    tmp29 = tmp20 * tmp20
    tmp30 = tl.broadcast_to(tmp29, [RBLOCK])
    tmp32 = triton_helpers.promote_to_tensor(tl.sum(tmp30, 0))
    tmp34 = tl.broadcast_to(tmp10, [RBLOCK])
    tmp36 = triton_helpers.promote_to_tensor(tl.sum(tmp34, 0))
    tmp37 = tl.full([1], 256, tl.int32)
    tmp38 = tmp37.to(tl.float32)
    tmp39 = tmp36 / tmp38
    tmp40 = tmp10 - tmp39
    tmp41 = tmp40 * tmp40
    tmp42 = tl.broadcast_to(tmp41, [RBLOCK])
    tmp44 = triton_helpers.promote_to_tensor(tl.sum(tmp42, 0))
    tmp46 = tl.broadcast_to(tmp13, [RBLOCK])
    tmp48 = triton_helpers.promote_to_tensor(tl.sum(tmp46, 0))
    tmp49 = tmp48 / tmp38
    tmp50 = tmp13 - tmp49
    tmp51 = tmp50 * tmp50
    tmp52 = tl.broadcast_to(tmp51, [RBLOCK])
    tmp54 = triton_helpers.promote_to_tensor(tl.sum(tmp52, 0))
    tmp55 = 1e-06
    tmp56 = tmp28 + tmp55
    tmp57 = libdevice.sqrt(tmp56)
    tmp58 = tmp32 + tmp55
    tmp59 = libdevice.sqrt(tmp58)
    tmp60 = tmp57 * tmp59
    tmp61 = tmp24 / tmp60
    tmp62 = 2.0
    tmp63 = tmp61 * tmp62
    tmp64 = 255.0
    tmp65 = tmp44 / tmp64
    tmp66 = libdevice.sqrt(tmp65)
    tmp67 = tmp63 * tmp66
    tmp68 = tmp54 / tmp64
    tmp69 = libdevice.sqrt(tmp68)
    tmp70 = tmp67 * tmp69
    tmp71 = tmp65 + tmp68
    tmp72 = tmp19 - tmp17
    tmp73 = tmp72 * tmp72
    tmp74 = tmp71 + tmp73
    tmp75 = tmp70 / tmp74
    tmp76 = 1.0
    tmp77 = tmp76 - tmp75
    tmp78 = 10.0
    tmp79 = tmp77 * tmp78
    tl.store(out_ptr0 + (tl.broadcast_to(r3, [RBLOCK])), tmp8, None)
    tl.debug_barrier()
    tl.store(in_out_ptr0 + (tl.full([1], 0, tl.int32)), tmp79, 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)
        buf1 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        # Topologically Sorted Source Nodes: [y_pred], Original ATen: [aten._softmax]
        stream0 = get_raw_stream(0)
        triton_poi_fused__softmax_0.run(arg0_1, buf1, 256, grid=grid(256), stream=stream0)
        del arg0_1
        buf2 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf11 = empty_strided_cuda((), (), torch.float32)
        buf21 = buf11; del buf11  # reuse
        buf22 = buf21; del buf21  # reuse
        # Topologically Sorted Source Nodes: [mean_2, vx, y_pred, mean_3, vy, mul, sum_1, pow_1, sum_2, add, sqrt, pow_2, sum_3, add_1, sqrt_1, mul_1, pcc, mul_2, y_true_std, mul_3, y_pred_std, mul_4, y_true_var, y_pred_var, add_2, y_pred_mean, y_true_mean, sub_2, pow_3, add_3, ccc, ccc_1, mul_5], Original ATen: [aten.mean, aten.sub, aten._softmax, aten.mul, aten.sum, aten.pow, aten.add, aten.sqrt, aten.div, aten.std, aten.var, aten.rsub]
        triton_per_fused__softmax_add_div_mean_mul_pow_rsub_sqrt_std_sub_sum_var_1.run(buf22, buf1, arg1_1, buf2, 1, 256, grid=grid(1), stream=stream0)
        del arg1_1
        del buf1
        del buf2
    return (buf22, )


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


class MCCLoss(nn.Module):

    def __init__(self, eps=1e-06):
        super(MCCLoss, self).__init__()
        self.eps = eps

    def forward(self, y_pred, y_true, w=None):
        y_pred = F.softmax(y_pred, dim=1)
        y_true_mean = torch.mean(y_true)
        y_pred_mean = torch.mean(y_pred)
        y_true_var = torch.var(y_true)
        y_pred_var = torch.var(y_pred)
        y_true_std = torch.std(y_true)
        y_pred_std = torch.std(y_pred)
        vx = y_true - torch.mean(y_true)
        vy = y_pred - torch.mean(y_pred)
        pcc = torch.sum(vx * vy) / (torch.sqrt(torch.sum(vx ** 2) + self.
            eps) * torch.sqrt(torch.sum(vy ** 2) + self.eps))
        ccc = 2 * pcc * y_true_std * y_pred_std / (y_true_var + y_pred_var +
            (y_pred_mean - y_true_mean) ** 2)
        ccc = 1 - ccc
        return ccc * 10


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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
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_poi_fused__softmax_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr
    ):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x3 = xindex
    x0 = xindex % 16
    x2 = xindex // 64
    tmp0 = tl.load(in_ptr0 + x3, xmask)
    tmp1 = tl.load(in_ptr0 + (x0 + 64 * x2), xmask, eviction_policy=
        'evict_last')
    tmp2 = tl.load(in_ptr0 + (16 + x0 + 64 * x2), xmask, eviction_policy=
        'evict_last')
    tmp4 = tl.load(in_ptr0 + (32 + x0 + 64 * x2), xmask, eviction_policy=
        'evict_last')
    tmp6 = tl.load(in_ptr0 + (48 + x0 + 64 * x2), xmask, eviction_policy=
        'evict_last')
    tmp3 = triton_helpers.maximum(tmp1, tmp2)
    tmp5 = triton_helpers.maximum(tmp3, tmp4)
    tmp7 = triton_helpers.maximum(tmp5, tmp6)
    tmp8 = tmp0 - tmp7
    tmp9 = tl_math.exp(tmp8)
    tl.store(out_ptr0 + x3, tmp9, xmask)


@triton.jit
def triton_per_fused__softmax_add_div_mean_mul_pow_rsub_sqrt_std_sub_sum_var_1(
    in_out_ptr0, in_ptr0, in_ptr1, out_ptr0, 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)
    r3 = rindex
    r0 = rindex % 16
    r2 = rindex // 64
    tmp0 = tl.load(in_ptr0 + r3, None)
    tmp1 = tl.load(in_ptr0 + (r0 + 64 * r2), None, eviction_policy='evict_last'
        )
    tmp2 = tl.load(in_ptr0 + (16 + r0 + 64 * r2), None, eviction_policy=
        'evict_last')
    tmp4 = tl.load(in_ptr0 + (32 + r0 + 64 * r2), None, eviction_policy=
        'evict_last')
    tmp6 = tl.load(in_ptr0 + (48 + r0 + 64 * r2), None, eviction_policy=
        'evict_last')
    tmp9 = tl.load(in_ptr1 + r3, None)
    tmp3 = tmp1 + tmp2
    tmp5 = tmp3 + tmp4
    tmp7 = tmp5 + tmp6
    tmp8 = tmp0 / tmp7
    tmp10 = tl.broadcast_to(tmp9, [RBLOCK])
    tmp12 = triton_helpers.promote_to_tensor(tl.sum(tmp10, 0))
    tmp13 = tl.broadcast_to(tmp8, [RBLOCK])
    tmp15 = triton_helpers.promote_to_tensor(tl.sum(tmp13, 0))
    tmp16 = 256.0
    tmp17 = tmp12 / tmp16
    tmp18 = tmp9 - tmp17
    tmp19 = tmp15 / tmp16
    tmp20 = tmp8 - tmp19
    tmp21 = tmp18 * tmp20
    tmp22 = tl.broadcast_to(tmp21, [RBLOCK])
    tmp24 = triton_helpers.promote_to_tensor(tl.sum(tmp22, 0))
    tmp25 = tmp18 * tmp18
    tmp26 = tl.broadcast_to(tmp25, [RBLOCK])
    tmp28 = triton_helpers.promote_to_tensor(tl.sum(tmp26, 0))
    tmp29 = tmp20 * tmp20
    tmp30 = tl.broadcast_to(tmp29, [RBLOCK])
    tmp32 = triton_helpers.promote_to_tensor(tl.sum(tmp30, 0))
    tmp34 = tl.broadcast_to(tmp10, [RBLOCK])
    tmp36 = triton_helpers.promote_to_tensor(tl.sum(tmp34, 0))
    tmp37 = tl.full([1], 256, tl.int32)
    tmp38 = tmp37.to(tl.float32)
    tmp39 = tmp36 / tmp38
    tmp40 = tmp10 - tmp39
    tmp41 = tmp40 * tmp40
    tmp42 = tl.broadcast_to(tmp41, [RBLOCK])
    tmp44 = triton_helpers.promote_to_tensor(tl.sum(tmp42, 0))
    tmp46 = tl.broadcast_to(tmp13, [RBLOCK])
    tmp48 = triton_helpers.promote_to_tensor(tl.sum(tmp46, 0))
    tmp49 = tmp48 / tmp38
    tmp50 = tmp13 - tmp49
    tmp51 = tmp50 * tmp50
    tmp52 = tl.broadcast_to(tmp51, [RBLOCK])
    tmp54 = triton_helpers.promote_to_tensor(tl.sum(tmp52, 0))
    tmp55 = 1e-06
    tmp56 = tmp28 + tmp55
    tmp57 = libdevice.sqrt(tmp56)
    tmp58 = tmp32 + tmp55
    tmp59 = libdevice.sqrt(tmp58)
    tmp60 = tmp57 * tmp59
    tmp61 = tmp24 / tmp60
    tmp62 = 2.0
    tmp63 = tmp61 * tmp62
    tmp64 = 255.0
    tmp65 = tmp44 / tmp64
    tmp66 = libdevice.sqrt(tmp65)
    tmp67 = tmp63 * tmp66
    tmp68 = tmp54 / tmp64
    tmp69 = libdevice.sqrt(tmp68)
    tmp70 = tmp67 * tmp69
    tmp71 = tmp65 + tmp68
    tmp72 = tmp19 - tmp17
    tmp73 = tmp72 * tmp72
    tmp74 = tmp71 + tmp73
    tmp75 = tmp70 / tmp74
    tmp76 = 1.0
    tmp77 = tmp76 - tmp75
    tmp78 = 10.0
    tmp79 = tmp77 * tmp78
    tl.store(out_ptr0 + tl.broadcast_to(r3, [RBLOCK]), tmp8, None)
    tl.debug_barrier()
    tl.store(in_out_ptr0 + tl.full([1], 0, tl.int32), tmp79, 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)
        buf1 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused__softmax_0[grid(256)](arg0_1, buf1, 256, XBLOCK=
            128, num_warps=4, num_stages=1)
        del arg0_1
        buf2 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf11 = empty_strided_cuda((), (), torch.float32)
        buf21 = buf11
        del buf11
        buf22 = buf21
        del buf21
        triton_per_fused__softmax_add_div_mean_mul_pow_rsub_sqrt_std_sub_sum_var_1[
            grid(1)](buf22, buf1, arg1_1, buf2, 1, 256, num_warps=2,
            num_stages=1)
        del arg1_1
        del buf1
        del buf2
    return buf22,


class MCCLossNew(nn.Module):

    def __init__(self, eps=1e-06):
        super(MCCLossNew, self).__init__()
        self.eps = eps

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