# 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_4/inductor_cache/wo/cwoengrvscqt5xm6wza73dkovcud6nyo3yd56mgv46p7mrciqlzn.py
# Topologically Sorted Source Nodes: [add_2, an, sub_1, mul_2, logit_n, logsumexp, neg, add, add_1, ap, neg_1, sub, mul, logit_p, logsumexp_1, add_3, loss], Original ATen: [aten.add, aten.clamp_min, aten.sub, aten.mul, aten.logsumexp, aten.neg, aten.softplus]
# Source node to ATen node mapping:
#   add => add
#   add_1 => add_1
#   add_2 => add_2
#   add_3 => add_5
#   an => clamp_min_1
#   ap => clamp_min
#   logit_n => mul_3
#   logit_p => mul_1
#   logsumexp => abs_1, add_3, amax, eq, exp, full_default, log, sub_2, sum_1, where
#   logsumexp_1 => abs_2, add_4, amax_1, eq_1, exp_1, full_default_1, log_1, sub_3, sum_2, where_1
#   loss => div, exp_2, gt, log1p, mul_4, where_2
#   mul => mul
#   mul_2 => mul_2
#   neg => neg
#   neg_1 => neg_1
#   sub => sub
#   sub_1 => sub_1
# Graph fragment:
#   %add_2 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%arg1_1, 4), kwargs = {})
#   %clamp_min_1 : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%add_2, 0.0), kwargs = {})
#   %sub_1 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg1_1, 4), kwargs = {})
#   %mul_2 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%clamp_min_1, %sub_1), kwargs = {})
#   %mul_3 : [num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul_2, 4), kwargs = {})
#   %amax : [num_users=2] = call_function[target=torch.ops.aten.amax.default](args = (%mul_3, [0], True), kwargs = {})
#   %abs_1 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%amax,), kwargs = {})
#   %eq : [num_users=1] = call_function[target=torch.ops.aten.eq.Scalar](args = (%abs_1, inf), kwargs = {})
#   %full_default : [num_users=1] = call_function[target=torch.ops.aten.full.default](args = ([], 0.0), kwargs = {dtype: torch.float32, layout: torch.strided, device: cuda:0, pin_memory: False})
#   %where : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%eq, %full_default, %amax), kwargs = {})
#   %sub_2 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_3, %where), kwargs = {})
#   %exp : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%sub_2,), kwargs = {})
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%exp, [0]), kwargs = {})
#   %log : [num_users=1] = call_function[target=torch.ops.aten.log.default](args = (%sum_1,), kwargs = {})
#   %add_3 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%log, %squeeze), kwargs = {})
#   %neg : [num_users=1] = call_function[target=torch.ops.aten.neg.default](args = (%arg0_1,), kwargs = {})
#   %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%neg, 1), kwargs = {})
#   %add_1 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add, 4), kwargs = {})
#   %clamp_min : [num_users=1] = call_function[target=torch.ops.aten.clamp_min.default](args = (%add_1, 0.0), kwargs = {})
#   %neg_1 : [num_users=1] = call_function[target=torch.ops.aten.neg.default](args = (%clamp_min,), kwargs = {})
#   %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg0_1, -3), kwargs = {})
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%neg_1, %sub), kwargs = {})
#   %mul_1 : [num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%mul, 4), kwargs = {})
#   %amax_1 : [num_users=2] = call_function[target=torch.ops.aten.amax.default](args = (%mul_1, [0], True), kwargs = {})
#   %abs_2 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%amax_1,), kwargs = {})
#   %eq_1 : [num_users=1] = call_function[target=torch.ops.aten.eq.Scalar](args = (%abs_2, inf), 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: cuda:0, pin_memory: False})
#   %where_1 : [num_users=2] = call_function[target=torch.ops.aten.where.self](args = (%eq_1, %full_default_1, %amax_1), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_1, %where_1), kwargs = {})
#   %exp_1 : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%sub_3,), kwargs = {})
#   %sum_2 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%exp_1, [0]), kwargs = {})
#   %log_1 : [num_users=1] = call_function[target=torch.ops.aten.log.default](args = (%sum_2,), kwargs = {})
#   %add_4 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%log_1, %squeeze_1), kwargs = {})
#   %add_5 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_3, %add_4), kwargs = {})
#   %mul_4 : [num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_5, 1.0), kwargs = {})
#   %gt : [num_users=1] = call_function[target=torch.ops.aten.gt.Scalar](args = (%mul_4, 20.0), kwargs = {})
#   %exp_2 : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%mul_4,), kwargs = {})
#   %log1p : [num_users=1] = call_function[target=torch.ops.aten.log1p.default](args = (%exp_2,), kwargs = {})
#   %div : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%log1p, 1.0), kwargs = {})
#   %where_2 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt, %add_5, %div), kwargs = {})
triton_poi_fused_add_clamp_min_logsumexp_mul_neg_softplus_sub_0 = async_compile.triton('triton_poi_fused_add_clamp_min_logsumexp_mul_neg_softplus_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.pointwise(
    size_hints=[64], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '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, 3), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_clamp_min_logsumexp_mul_neg_softplus_sub_0', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 8, '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_add_clamp_min_logsumexp_mul_neg_softplus_sub_0(in_out_ptr0, in_ptr0, in_ptr1, xnumel, XBLOCK : tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + (x0), xmask)
    tmp8 = tl.load(in_ptr0 + (64 + x0), xmask)
    tmp15 = tl.load(in_ptr0 + (128 + x0), xmask)
    tmp22 = tl.load(in_ptr0 + (192 + x0), xmask)
    tmp44 = tl.load(in_ptr1 + (x0), xmask)
    tmp55 = tl.load(in_ptr1 + (64 + x0), xmask)
    tmp65 = tl.load(in_ptr1 + (128 + x0), xmask)
    tmp75 = tl.load(in_ptr1 + (192 + x0), xmask)
    tmp1 = 4.0
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = triton_helpers.maximum(tmp2, tmp3)
    tmp5 = tmp0 - tmp1
    tmp6 = tmp4 * tmp5
    tmp7 = tmp6 * tmp1
    tmp9 = tmp8 + tmp1
    tmp10 = triton_helpers.maximum(tmp9, tmp3)
    tmp11 = tmp8 - tmp1
    tmp12 = tmp10 * tmp11
    tmp13 = tmp12 * tmp1
    tmp14 = triton_helpers.maximum(tmp7, tmp13)
    tmp16 = tmp15 + tmp1
    tmp17 = triton_helpers.maximum(tmp16, tmp3)
    tmp18 = tmp15 - tmp1
    tmp19 = tmp17 * tmp18
    tmp20 = tmp19 * tmp1
    tmp21 = triton_helpers.maximum(tmp14, tmp20)
    tmp23 = tmp22 + tmp1
    tmp24 = triton_helpers.maximum(tmp23, tmp3)
    tmp25 = tmp22 - tmp1
    tmp26 = tmp24 * tmp25
    tmp27 = tmp26 * tmp1
    tmp28 = triton_helpers.maximum(tmp21, tmp27)
    tmp29 = tl_math.abs(tmp28)
    tmp30 = float("inf")
    tmp31 = tmp29 == tmp30
    tmp32 = tl.where(tmp31, tmp3, tmp28)
    tmp33 = tmp7 - tmp32
    tmp34 = tl_math.exp(tmp33)
    tmp35 = tmp13 - tmp32
    tmp36 = tl_math.exp(tmp35)
    tmp37 = tmp34 + tmp36
    tmp38 = tmp20 - tmp32
    tmp39 = tl_math.exp(tmp38)
    tmp40 = tmp37 + tmp39
    tmp41 = tmp27 - tmp32
    tmp42 = tl_math.exp(tmp41)
    tmp43 = tmp40 + tmp42
    tmp45 = -tmp44
    tmp46 = 1.0
    tmp47 = tmp45 + tmp46
    tmp48 = tmp47 + tmp1
    tmp49 = triton_helpers.maximum(tmp48, tmp3)
    tmp50 = -tmp49
    tmp51 = -3.0
    tmp52 = tmp44 - tmp51
    tmp53 = tmp50 * tmp52
    tmp54 = tmp53 * tmp1
    tmp56 = -tmp55
    tmp57 = tmp56 + tmp46
    tmp58 = tmp57 + tmp1
    tmp59 = triton_helpers.maximum(tmp58, tmp3)
    tmp60 = -tmp59
    tmp61 = tmp55 - tmp51
    tmp62 = tmp60 * tmp61
    tmp63 = tmp62 * tmp1
    tmp64 = triton_helpers.maximum(tmp54, tmp63)
    tmp66 = -tmp65
    tmp67 = tmp66 + tmp46
    tmp68 = tmp67 + tmp1
    tmp69 = triton_helpers.maximum(tmp68, tmp3)
    tmp70 = -tmp69
    tmp71 = tmp65 - tmp51
    tmp72 = tmp70 * tmp71
    tmp73 = tmp72 * tmp1
    tmp74 = triton_helpers.maximum(tmp64, tmp73)
    tmp76 = -tmp75
    tmp77 = tmp76 + tmp46
    tmp78 = tmp77 + tmp1
    tmp79 = triton_helpers.maximum(tmp78, tmp3)
    tmp80 = -tmp79
    tmp81 = tmp75 - tmp51
    tmp82 = tmp80 * tmp81
    tmp83 = tmp82 * tmp1
    tmp84 = triton_helpers.maximum(tmp74, tmp83)
    tmp85 = tl_math.abs(tmp84)
    tmp86 = tmp85 == tmp30
    tmp87 = tl.where(tmp86, tmp3, tmp84)
    tmp88 = tmp54 - tmp87
    tmp89 = tl_math.exp(tmp88)
    tmp90 = tmp63 - tmp87
    tmp91 = tl_math.exp(tmp90)
    tmp92 = tmp89 + tmp91
    tmp93 = tmp73 - tmp87
    tmp94 = tl_math.exp(tmp93)
    tmp95 = tmp92 + tmp94
    tmp96 = tmp83 - tmp87
    tmp97 = tl_math.exp(tmp96)
    tmp98 = tmp95 + tmp97
    tmp99 = tl_math.log(tmp43)
    tmp100 = tmp99 + tmp32
    tmp101 = tl_math.log(tmp98)
    tmp102 = tmp101 + tmp87
    tmp103 = tmp100 + tmp102
    tmp104 = tmp103 * tmp46
    tmp105 = 20.0
    tmp106 = tmp104 > tmp105
    tmp107 = tl_math.exp(tmp104)
    tmp108 = libdevice.log1p(tmp107)
    tmp109 = tmp108 * tmp46
    tmp110 = tl.where(tmp106, tmp103, tmp109)
    tl.store(in_out_ptr0 + (x0), tmp110, xmask)
''', 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)
        buf2 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        buf5 = buf2; del buf2  # reuse
        # Topologically Sorted Source Nodes: [add_2, an, sub_1, mul_2, logit_n, logsumexp, neg, add, add_1, ap, neg_1, sub, mul, logit_p, logsumexp_1, add_3, loss], Original ATen: [aten.add, aten.clamp_min, aten.sub, aten.mul, aten.logsumexp, aten.neg, aten.softplus]
        stream0 = get_raw_stream(0)
        triton_poi_fused_add_clamp_min_logsumexp_mul_neg_softplus_sub_0.run(buf5, arg1_1, arg0_1, 64, grid=grid(64), stream=stream0)
        del arg0_1
        del arg1_1
    return (buf5, )


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


class CircleLoss(nn.Module):

    def __init__(self, m: 'float', gamma: 'float') ->None:
        super(CircleLoss, self).__init__()
        self.m = m
        self.gamma = gamma
        self.soft_plus = nn.Softplus()

    def forward(self, sp: 'Tensor', sn: 'Tensor') ->Tensor:
        ap = torch.clamp_min(-sp.detach() + 1 + self.m, min=0.0)
        an = torch.clamp_min(sn.detach() + self.m, min=0.0)
        delta_p = 1 - self.m
        delta_n = self.m
        logit_p = -ap * (sp - delta_p) * self.gamma
        logit_n = an * (sn - delta_n) * self.gamma
        loss = self.soft_plus(torch.logsumexp(logit_n, dim=0) + torch.
            logsumexp(logit_p, dim=0))
        return loss


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


def get_init_inputs():
    return [[], {'m': 4, 'gamma': 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 import triton_helpers
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_poi_fused_add_clamp_min_logsumexp_mul_neg_softplus_sub_0(in_out_ptr0
    , in_ptr0, in_ptr1, xnumel, XBLOCK: tl.constexpr):
    xnumel = 64
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + x0, xmask)
    tmp8 = tl.load(in_ptr0 + (64 + x0), xmask)
    tmp15 = tl.load(in_ptr0 + (128 + x0), xmask)
    tmp22 = tl.load(in_ptr0 + (192 + x0), xmask)
    tmp44 = tl.load(in_ptr1 + x0, xmask)
    tmp55 = tl.load(in_ptr1 + (64 + x0), xmask)
    tmp65 = tl.load(in_ptr1 + (128 + x0), xmask)
    tmp75 = tl.load(in_ptr1 + (192 + x0), xmask)
    tmp1 = 4.0
    tmp2 = tmp0 + tmp1
    tmp3 = 0.0
    tmp4 = triton_helpers.maximum(tmp2, tmp3)
    tmp5 = tmp0 - tmp1
    tmp6 = tmp4 * tmp5
    tmp7 = tmp6 * tmp1
    tmp9 = tmp8 + tmp1
    tmp10 = triton_helpers.maximum(tmp9, tmp3)
    tmp11 = tmp8 - tmp1
    tmp12 = tmp10 * tmp11
    tmp13 = tmp12 * tmp1
    tmp14 = triton_helpers.maximum(tmp7, tmp13)
    tmp16 = tmp15 + tmp1
    tmp17 = triton_helpers.maximum(tmp16, tmp3)
    tmp18 = tmp15 - tmp1
    tmp19 = tmp17 * tmp18
    tmp20 = tmp19 * tmp1
    tmp21 = triton_helpers.maximum(tmp14, tmp20)
    tmp23 = tmp22 + tmp1
    tmp24 = triton_helpers.maximum(tmp23, tmp3)
    tmp25 = tmp22 - tmp1
    tmp26 = tmp24 * tmp25
    tmp27 = tmp26 * tmp1
    tmp28 = triton_helpers.maximum(tmp21, tmp27)
    tmp29 = tl_math.abs(tmp28)
    tmp30 = float('inf')
    tmp31 = tmp29 == tmp30
    tmp32 = tl.where(tmp31, tmp3, tmp28)
    tmp33 = tmp7 - tmp32
    tmp34 = tl_math.exp(tmp33)
    tmp35 = tmp13 - tmp32
    tmp36 = tl_math.exp(tmp35)
    tmp37 = tmp34 + tmp36
    tmp38 = tmp20 - tmp32
    tmp39 = tl_math.exp(tmp38)
    tmp40 = tmp37 + tmp39
    tmp41 = tmp27 - tmp32
    tmp42 = tl_math.exp(tmp41)
    tmp43 = tmp40 + tmp42
    tmp45 = -tmp44
    tmp46 = 1.0
    tmp47 = tmp45 + tmp46
    tmp48 = tmp47 + tmp1
    tmp49 = triton_helpers.maximum(tmp48, tmp3)
    tmp50 = -tmp49
    tmp51 = -3.0
    tmp52 = tmp44 - tmp51
    tmp53 = tmp50 * tmp52
    tmp54 = tmp53 * tmp1
    tmp56 = -tmp55
    tmp57 = tmp56 + tmp46
    tmp58 = tmp57 + tmp1
    tmp59 = triton_helpers.maximum(tmp58, tmp3)
    tmp60 = -tmp59
    tmp61 = tmp55 - tmp51
    tmp62 = tmp60 * tmp61
    tmp63 = tmp62 * tmp1
    tmp64 = triton_helpers.maximum(tmp54, tmp63)
    tmp66 = -tmp65
    tmp67 = tmp66 + tmp46
    tmp68 = tmp67 + tmp1
    tmp69 = triton_helpers.maximum(tmp68, tmp3)
    tmp70 = -tmp69
    tmp71 = tmp65 - tmp51
    tmp72 = tmp70 * tmp71
    tmp73 = tmp72 * tmp1
    tmp74 = triton_helpers.maximum(tmp64, tmp73)
    tmp76 = -tmp75
    tmp77 = tmp76 + tmp46
    tmp78 = tmp77 + tmp1
    tmp79 = triton_helpers.maximum(tmp78, tmp3)
    tmp80 = -tmp79
    tmp81 = tmp75 - tmp51
    tmp82 = tmp80 * tmp81
    tmp83 = tmp82 * tmp1
    tmp84 = triton_helpers.maximum(tmp74, tmp83)
    tmp85 = tl_math.abs(tmp84)
    tmp86 = tmp85 == tmp30
    tmp87 = tl.where(tmp86, tmp3, tmp84)
    tmp88 = tmp54 - tmp87
    tmp89 = tl_math.exp(tmp88)
    tmp90 = tmp63 - tmp87
    tmp91 = tl_math.exp(tmp90)
    tmp92 = tmp89 + tmp91
    tmp93 = tmp73 - tmp87
    tmp94 = tl_math.exp(tmp93)
    tmp95 = tmp92 + tmp94
    tmp96 = tmp83 - tmp87
    tmp97 = tl_math.exp(tmp96)
    tmp98 = tmp95 + tmp97
    tmp99 = tl_math.log(tmp43)
    tmp100 = tmp99 + tmp32
    tmp101 = tl_math.log(tmp98)
    tmp102 = tmp101 + tmp87
    tmp103 = tmp100 + tmp102
    tmp104 = tmp103 * tmp46
    tmp105 = 20.0
    tmp106 = tmp104 > tmp105
    tmp107 = tl_math.exp(tmp104)
    tmp108 = libdevice.log1p(tmp107)
    tmp109 = tmp108 * tmp46
    tmp110 = tl.where(tmp106, tmp103, tmp109)
    tl.store(in_out_ptr0 + x0, tmp110, xmask)


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)
        buf2 = empty_strided_cuda((4, 4, 4), (16, 4, 1), torch.float32)
        buf5 = buf2
        del buf2
        get_raw_stream(0)
        triton_poi_fused_add_clamp_min_logsumexp_mul_neg_softplus_sub_0[grid
            (64)](buf5, arg1_1, arg0_1, 64, XBLOCK=64, num_warps=1,
            num_stages=1)
        del arg0_1
        del arg1_1
    return buf5,


class CircleLossNew(nn.Module):

    def __init__(self, m: 'float', gamma: 'float') ->None:
        super(CircleLossNew, self).__init__()
        self.m = m
        self.gamma = gamma
        self.soft_plus = nn.Softplus()

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