# 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/dy/cdye32zdr3cicbbaex3vhj3rludh22pvzjjm43zjdv7rkt2htpyv.py
# Topologically Sorted Source Nodes: [sub_5, abs_1, zeros, sub_3, sign, gamma_U_hard, sub_4, sign_1, gamma_L_hard, gamma_hard, mul_4, mean_2, mean_3, add, qd_lhs_hard, zero, sub_1, mul, gamma_U, sub_2, mul_1, gamma_L, gamma_, PICP_soft, sub_7, max_3, pow_1, qd_rhs_soft, qd_loss_soft, PICP, sub, MPIW, tensor_1, y_var_limited, exp, add_4, log, tensor_2, y_var], Original ATen: [aten.sub, aten.abs, aten.zeros_like, aten.sign, aten.maximum, aten.mul, aten.mean, aten.add, aten.div, aten.lift_fresh, aten.sigmoid, aten.rsub, aten.pow, aten.minimum, aten.exp, aten.log]
# Source node to ATen node mapping:
#   MPIW => mean_1
#   PICP => mean_11
#   PICP_soft => mean_6
#   abs_1 => abs_1
#   add => add
#   add_4 => add_4
#   exp => exp
#   gamma_ => mul_2
#   gamma_L => sigmoid_1
#   gamma_L_hard => maximum_1
#   gamma_U => sigmoid
#   gamma_U_hard => maximum
#   gamma_hard => mul_3
#   log => log
#   max_3 => maximum_2
#   mean_2 => mean_2
#   mean_3 => mean_3
#   mul => mul
#   mul_1 => mul_1
#   mul_4 => mul_4
#   pow_1 => pow_1
#   qd_lhs_hard => div
#   qd_loss_soft => add_2
#   qd_rhs_soft => mul_6
#   sign => sign
#   sign_1 => sign_1
#   sub => sub
#   sub_1 => sub_1
#   sub_2 => sub_2
#   sub_3 => sub_3
#   sub_4 => sub_4
#   sub_5 => sub_5
#   sub_7 => sub_7
#   tensor_1 => full_default_2
#   tensor_2 => full_default_3
#   y_var => maximum_4
#   y_var_limited => minimum
#   zero => full_default_1
#   zeros => full_default
# Graph fragment:
#   %sub_5 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select, %select_1), kwargs = {})
#   %abs_1 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_5,), kwargs = {})
#   %full_default : [num_users=2] = call_function[target=torch.ops.aten.full.default](args = ([4, 4, 4], 0), kwargs = {dtype: torch.float32, layout: torch.strided, device: cuda:0, pin_memory: False})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select, %select_2), kwargs = {})
#   %sign : [num_users=1] = call_function[target=torch.ops.aten.sign.default](args = (%sub_3,), kwargs = {})
#   %maximum : [num_users=1] = call_function[target=torch.ops.aten.maximum.default](args = (%full_default, %sign), kwargs = {})
#   %sub_4 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_2, %select_1), kwargs = {})
#   %sign_1 : [num_users=1] = call_function[target=torch.ops.aten.sign.default](args = (%sub_4,), kwargs = {})
#   %maximum_1 : [num_users=1] = call_function[target=torch.ops.aten.maximum.default](args = (%full_default, %sign_1), kwargs = {})
#   %mul_3 : [num_users=3] = call_function[target=torch.ops.aten.mul.Tensor](args = (%maximum, %maximum_1), kwargs = {})
#   %mul_4 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%abs_1, %mul_3), kwargs = {})
#   %mean_2 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%mul_4,), kwargs = {})
#   %mean_3 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%mul_3,), kwargs = {})
#   %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mean_3, 0.001), kwargs = {})
#   %div : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%mean_2, %add), kwargs = {})
#   %full_default_1 : [num_users=1] = call_function[target=torch.ops.aten.full.default](args = ([], 0.0), kwargs = {dtype: torch.float32, layout: torch.strided, device: cpu, pin_memory: False})
#   %sub_1 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select, %select_2), kwargs = {})
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_1, 100.0), kwargs = {})
#   %sigmoid : [num_users=1] = call_function[target=torch.ops.aten.sigmoid.default](args = (%mul,), kwargs = {})
#   %sub_2 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_2, %select_1), kwargs = {})
#   %mul_1 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_2, 100.0), kwargs = {})
#   %sigmoid_1 : [num_users=1] = call_function[target=torch.ops.aten.sigmoid.default](args = (%mul_1,), kwargs = {})
#   %mul_2 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sigmoid, %sigmoid_1), kwargs = {})
#   %mean_6 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%mul_2,), kwargs = {})
#   %sub_7 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (0.9, %mean_6), kwargs = {})
#   %maximum_2 : [num_users=1] = call_function[target=torch.ops.aten.maximum.default](args = (%full_default_1, %sub_7), kwargs = {})
#   %pow_1 : [num_users=1] = call_function[target=torch.ops.aten.pow.Tensor_Scalar](args = (%maximum_2, 2), kwargs = {})
#   %mul_6 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%pow_1, 20.0), kwargs = {})
#   %add_2 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%div, %mul_6), kwargs = {})
#   %mean_11 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%mul_3,), kwargs = {})
#   %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select, %select_1), kwargs = {})
#   %mean_1 : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%sub,), kwargs = {})
#   %full_default_2 : [num_users=1] = call_function[target=torch.ops.aten.full.default](args = ([], 10.0), kwargs = {dtype: torch.float32, layout: torch.strided, device: cpu, pin_memory: False})
#   %minimum : [num_users=1] = call_function[target=torch.ops.aten.minimum.default](args = (%select_1, %full_default_2), kwargs = {})
#   %exp : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%minimum,), kwargs = {})
#   %add_4 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%exp, 1.0), kwargs = {})
#   %log : [num_users=1] = call_function[target=torch.ops.aten.log.default](args = (%add_4,), kwargs = {})
#   %full_default_3 : [num_users=1] = call_function[target=torch.ops.aten.full.default](args = ([], 9.999999747378752e-06), kwargs = {dtype: torch.float32, layout: torch.strided, device: cpu, pin_memory: False})
#   %maximum_4 : [num_users=1] = call_function[target=torch.ops.aten.maximum.default](args = (%log, %full_default_3), kwargs = {})
triton_per_fused_abs_add_div_exp_lift_fresh_log_maximum_mean_minimum_mul_pow_rsub_sigmoid_sign_sub_zeros_like_0 = async_compile.triton('triton_per_fused_abs_add_div_exp_lift_fresh_log_maximum_mean_minimum_mul_pow_rsub_sigmoid_sign_sub_zeros_like_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: '*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_abs_add_div_exp_lift_fresh_log_maximum_mean_minimum_mul_pow_rsub_sigmoid_sign_sub_zeros_like_0', 'mutated_arg_names': ['in_out_ptr0', 'in_out_ptr1', 'in_out_ptr2'], 'no_x_dim': False, 'num_load': 3, 'num_reduction': 5, '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_abs_add_div_exp_lift_fresh_log_maximum_mean_minimum_mul_pow_rsub_sigmoid_sign_sub_zeros_like_0(in_out_ptr0, in_out_ptr1, in_out_ptr2, in_ptr0, in_ptr1, out_ptr2, 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 % 16
    r1 = (rindex // 16)
    r2 = rindex
    tmp0 = tl.load(in_ptr0 + (r0 + (64*r1)), None)
    tmp1 = tl.load(in_ptr0 + (16 + r0 + (64*r1)), None)
    tmp4 = tl.load(in_ptr1 + (r0 + (64*r1)), None)
    tmp2 = tmp0 - tmp1
    tmp3 = tl_math.abs(tmp2)
    tmp5 = tmp0 - tmp4
    tmp6 = tl.full([1, 1], 0, tl.int32)
    tmp7 = tmp6 < tmp5
    tmp8 = tmp7.to(tl.int8)
    tmp9 = tmp5 < tmp6
    tmp10 = tmp9.to(tl.int8)
    tmp11 = tmp8 - tmp10
    tmp12 = tmp11.to(tmp5.dtype)
    tmp13 = 0.0
    tmp14 = triton_helpers.maximum(tmp13, tmp12)
    tmp15 = tmp4 - tmp1
    tmp16 = tmp6 < tmp15
    tmp17 = tmp16.to(tl.int8)
    tmp18 = tmp15 < tmp6
    tmp19 = tmp18.to(tl.int8)
    tmp20 = tmp17 - tmp19
    tmp21 = tmp20.to(tmp15.dtype)
    tmp22 = triton_helpers.maximum(tmp13, tmp21)
    tmp23 = tmp14 * tmp22
    tmp24 = tmp3 * tmp23
    tmp25 = tl.broadcast_to(tmp24, [XBLOCK, RBLOCK])
    tmp27 = tl.sum(tmp25, 1)[:, None]
    tmp28 = tl.broadcast_to(tmp23, [XBLOCK, RBLOCK])
    tmp30 = tl.sum(tmp28, 1)[:, None]
    tmp31 = 100.0
    tmp32 = tmp5 * tmp31
    tmp33 = tl.sigmoid(tmp32)
    tmp34 = tmp15 * tmp31
    tmp35 = tl.sigmoid(tmp34)
    tmp36 = tmp33 * tmp35
    tmp37 = tl.broadcast_to(tmp36, [XBLOCK, RBLOCK])
    tmp39 = tl.sum(tmp37, 1)[:, None]
    tmp40 = tl.broadcast_to(tmp2, [XBLOCK, RBLOCK])
    tmp42 = tl.sum(tmp40, 1)[:, None]
    tmp43 = 10.0
    tmp44 = triton_helpers.minimum(tmp1, tmp43)
    tmp45 = tl_math.exp(tmp44)
    tmp46 = 1.0
    tmp47 = tmp45 + tmp46
    tmp48 = tl_math.log(tmp47)
    tmp49 = 9.999999747378752e-06
    tmp50 = triton_helpers.maximum(tmp48, tmp49)
    tmp51 = 64.0
    tmp52 = tmp27 / tmp51
    tmp53 = tmp30 / tmp51
    tmp54 = 0.001
    tmp55 = tmp53 + tmp54
    tmp56 = tmp52 / tmp55
    tmp57 = tmp39 / tmp51
    tmp58 = 0.9
    tmp59 = tmp58 - tmp57
    tmp60 = triton_helpers.maximum(tmp13, tmp59)
    tmp61 = tmp60 * tmp60
    tmp62 = 20.0
    tmp63 = tmp61 * tmp62
    tmp64 = tmp56 + tmp63
    tmp65 = tmp42 / tmp51
    tl.store(out_ptr2 + (tl.broadcast_to(r2, [XBLOCK, RBLOCK])), tmp50, None)
    tl.debug_barrier()
    tl.store(in_out_ptr0 + (tl.full([XBLOCK, 1], 0, tl.int32)), tmp64, None)
    tl.debug_barrier()
    tl.store(in_out_ptr1 + (tl.full([XBLOCK, 1], 0, tl.int32)), tmp53, None)
    tl.debug_barrier()
    tl.store(in_out_ptr2 + (tl.full([XBLOCK, 1], 0, tl.int32)), tmp65, 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 = empty_strided_cuda((), (), torch.float32)
        buf4 = empty_strided_cuda((), (), torch.float32)
        buf5 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        buf6 = buf0; del buf0  # reuse
        buf7 = buf3; del buf3  # reuse
        buf8 = buf4; del buf4  # reuse
        # Topologically Sorted Source Nodes: [sub_5, abs_1, zeros, sub_3, sign, gamma_U_hard, sub_4, sign_1, gamma_L_hard, gamma_hard, mul_4, mean_2, mean_3, add, qd_lhs_hard, zero, sub_1, mul, gamma_U, sub_2, mul_1, gamma_L, gamma_, PICP_soft, sub_7, max_3, pow_1, qd_rhs_soft, qd_loss_soft, PICP, sub, MPIW, tensor_1, y_var_limited, exp, add_4, log, tensor_2, y_var], Original ATen: [aten.sub, aten.abs, aten.zeros_like, aten.sign, aten.maximum, aten.mul, aten.mean, aten.add, aten.div, aten.lift_fresh, aten.sigmoid, aten.rsub, aten.pow, aten.minimum, aten.exp, aten.log]
        stream0 = get_raw_stream(0)
        triton_per_fused_abs_add_div_exp_lift_fresh_log_maximum_mean_minimum_mul_pow_rsub_sigmoid_sign_sub_zeros_like_0.run(buf6, buf7, buf8, arg0_1, arg1_1, buf5, 1, 64, grid=grid(1), stream=stream0)
        del arg1_1
    return (buf6, buf7, buf8, buf5, reinterpret_tensor(arg0_1, (4, 4, 4), (64, 4, 1), 0), )


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


class Loss(nn.Module):

    def __init__(self, device, type_in='pred_intervals', alpha=0.1,
        loss_type='qd_soft', censor_R=False, soften=100.0, lambda_in=10.0,
        sigma_in=0.5):
        super().__init__()
        self.alpha = alpha
        self.lambda_in = lambda_in
        self.soften = soften
        self.loss_type = loss_type
        self.type_in = type_in
        self.censor_R = censor_R
        self.sigma_in = sigma_in
        self.device = device

    def forward(self, y_pred, y_true):
        if self.type_in == 'pred_intervals':
            metric = []
            metric_name = []
            y_U = y_pred[:, 0]
            y_L = y_pred[:, 1]
            y_T = y_true[:, 0]
            N_ = y_T.shape[0]
            alpha_ = self.alpha
            lambda_ = self.lambda_in
            torch.mean(y_pred, dim=1)
            MPIW = torch.mean(y_U - y_L)
            gamma_U = torch.sigmoid((y_U - y_T) * self.soften)
            gamma_L = torch.sigmoid((y_T - y_L) * self.soften)
            gamma_ = torch.mul(gamma_U, gamma_L)
            torch.ones_like(gamma_)
            zeros = torch.zeros_like(y_U)
            gamma_U_hard = torch.max(zeros, torch.sign(y_U - y_T))
            gamma_L_hard = torch.max(zeros, torch.sign(y_T - y_L))
            gamma_hard = torch.mul(gamma_U_hard, gamma_L_hard)
            qd_lhs_hard = torch.div(torch.mean(torch.abs(y_U - y_L) *
                gamma_hard), torch.mean(gamma_hard) + 0.001)
            torch.div(torch.mean(torch.abs(y_U - y_L) * gamma_), torch.mean
                (gamma_) + 0.001)
            PICP_soft = torch.mean(gamma_)
            PICP_hard = torch.mean(gamma_hard)
            zero = torch.tensor(0.0)
            qd_rhs_soft = lambda_ * math.sqrt(N_) * torch.pow(torch.max(
                zero, 1.0 - alpha_ - PICP_soft), 2)
            qd_rhs_hard = lambda_ * math.sqrt(N_) * torch.pow(torch.max(
                zero, 1.0 - alpha_ - PICP_hard), 2)
            qd_loss_soft = qd_lhs_hard + qd_rhs_soft
            qd_loss_hard = qd_lhs_hard + qd_rhs_hard
            y_mean = y_U
            y_var_limited = torch.min(y_L, torch.tensor(10.0))
            y_var = torch.max(torch.log(1.0 + torch.exp(y_var_limited)),
                torch.tensor(1e-05))
            self.y_mean = y_mean
            self.y_var = y_var
            gauss_loss = torch.log(y_var) / 2.0 + torch.div(torch.pow(y_T -
                y_mean, 2), 2.0 * y_var)
            gauss_loss = torch.mean(gauss_loss)
            if self.loss_type == 'qd_soft':
                loss = qd_loss_soft
            elif self.loss_type == 'qd_hard':
                loss = qd_loss_hard
            elif self.loss_type == 'gauss_like':
                loss = gauss_loss
            elif self.loss_type == 'picp':
                loss = PICP_hard
            elif self.loss_type == 'mse':
                loss = torch.mean(torch.pow(y_U - y_T, 2))
            torch.mean(gamma_U_hard)
            torch.mean(gamma_L_hard)
            PICP = torch.mean(gamma_hard)
            metric.append(PICP)
            metric_name.append('PICP')
            metric.append(MPIW)
            metric_name.append('MPIW')
        return loss, PICP, MPIW


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


def get_init_inputs():
    return [[], {'device': 0}]

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 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
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor


@triton.jit
def triton_per_fused_abs_add_div_exp_lift_fresh_log_maximum_mean_minimum_mul_pow_rsub_sigmoid_sign_sub_zeros_like_0(
    in_out_ptr0, in_out_ptr1, in_out_ptr2, in_ptr0, in_ptr1, out_ptr2,
    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 % 16
    r1 = rindex // 16
    r2 = rindex
    tmp0 = tl.load(in_ptr0 + (r0 + 64 * r1), None)
    tmp1 = tl.load(in_ptr0 + (16 + r0 + 64 * r1), None)
    tmp4 = tl.load(in_ptr1 + (r0 + 64 * r1), None)
    tmp2 = tmp0 - tmp1
    tmp3 = tl_math.abs(tmp2)
    tmp5 = tmp0 - tmp4
    tmp6 = tl.full([1, 1], 0, tl.int32)
    tmp7 = tmp6 < tmp5
    tmp8 = tmp7.to(tl.int8)
    tmp9 = tmp5 < tmp6
    tmp10 = tmp9.to(tl.int8)
    tmp11 = tmp8 - tmp10
    tmp12 = tmp11.to(tmp5.dtype)
    tmp13 = 0.0
    tmp14 = triton_helpers.maximum(tmp13, tmp12)
    tmp15 = tmp4 - tmp1
    tmp16 = tmp6 < tmp15
    tmp17 = tmp16.to(tl.int8)
    tmp18 = tmp15 < tmp6
    tmp19 = tmp18.to(tl.int8)
    tmp20 = tmp17 - tmp19
    tmp21 = tmp20.to(tmp15.dtype)
    tmp22 = triton_helpers.maximum(tmp13, tmp21)
    tmp23 = tmp14 * tmp22
    tmp24 = tmp3 * tmp23
    tmp25 = tl.broadcast_to(tmp24, [XBLOCK, RBLOCK])
    tmp27 = tl.sum(tmp25, 1)[:, None]
    tmp28 = tl.broadcast_to(tmp23, [XBLOCK, RBLOCK])
    tmp30 = tl.sum(tmp28, 1)[:, None]
    tmp31 = 100.0
    tmp32 = tmp5 * tmp31
    tmp33 = tl.sigmoid(tmp32)
    tmp34 = tmp15 * tmp31
    tmp35 = tl.sigmoid(tmp34)
    tmp36 = tmp33 * tmp35
    tmp37 = tl.broadcast_to(tmp36, [XBLOCK, RBLOCK])
    tmp39 = tl.sum(tmp37, 1)[:, None]
    tmp40 = tl.broadcast_to(tmp2, [XBLOCK, RBLOCK])
    tmp42 = tl.sum(tmp40, 1)[:, None]
    tmp43 = 10.0
    tmp44 = triton_helpers.minimum(tmp1, tmp43)
    tmp45 = tl_math.exp(tmp44)
    tmp46 = 1.0
    tmp47 = tmp45 + tmp46
    tmp48 = tl_math.log(tmp47)
    tmp49 = 9.999999747378752e-06
    tmp50 = triton_helpers.maximum(tmp48, tmp49)
    tmp51 = 64.0
    tmp52 = tmp27 / tmp51
    tmp53 = tmp30 / tmp51
    tmp54 = 0.001
    tmp55 = tmp53 + tmp54
    tmp56 = tmp52 / tmp55
    tmp57 = tmp39 / tmp51
    tmp58 = 0.9
    tmp59 = tmp58 - tmp57
    tmp60 = triton_helpers.maximum(tmp13, tmp59)
    tmp61 = tmp60 * tmp60
    tmp62 = 20.0
    tmp63 = tmp61 * tmp62
    tmp64 = tmp56 + tmp63
    tmp65 = tmp42 / tmp51
    tl.store(out_ptr2 + tl.broadcast_to(r2, [XBLOCK, RBLOCK]), tmp50, None)
    tl.debug_barrier()
    tl.store(in_out_ptr0 + tl.full([XBLOCK, 1], 0, tl.int32), tmp64, None)
    tl.debug_barrier()
    tl.store(in_out_ptr1 + tl.full([XBLOCK, 1], 0, tl.int32), tmp53, None)
    tl.debug_barrier()
    tl.store(in_out_ptr2 + tl.full([XBLOCK, 1], 0, tl.int32), tmp65, 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 = empty_strided_cuda((), (), torch.float32)
        buf4 = empty_strided_cuda((), (), torch.float32)
        buf5 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        buf6 = buf0
        del buf0
        buf7 = buf3
        del buf3
        buf8 = buf4
        del buf4
        get_raw_stream(0)
        triton_per_fused_abs_add_div_exp_lift_fresh_log_maximum_mean_minimum_mul_pow_rsub_sigmoid_sign_sub_zeros_like_0[
            grid(1)](buf6, buf7, buf8, arg0_1, arg1_1, buf5, 1, 64, XBLOCK=
            1, num_warps=2, num_stages=1)
        del arg1_1
    return buf6, buf7, buf8, buf5, reinterpret_tensor(arg0_1, (4, 4, 4), (
        64, 4, 1), 0)


class LossNew(nn.Module):

    def __init__(self, device, type_in='pred_intervals', alpha=0.1,
        loss_type='qd_soft', censor_R=False, soften=100.0, lambda_in=10.0,
        sigma_in=0.5):
        super().__init__()
        self.alpha = alpha
        self.lambda_in = lambda_in
        self.soften = soften
        self.loss_type = loss_type
        self.type_in = type_in
        self.censor_R = censor_R
        self.sigma_in = sigma_in
        self.device = device

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