# 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/k3/ck3futvjgnn5ywxhit2wnwjstmaqothiqqhmuc5447rgoovbelmt.py
# Topologically Sorted Source Nodes: [invprobs, neg_3, mul_1, sub_2, mul_2, mul_3, exp_2, mul, sub, neg, max_val, add, neg_1, exp, neg_2, sub_1, exp_1, add_1, log, loss, loss_1, sum_1, mean], Original ATen: [aten.log_sigmoid_forward, aten.neg, aten.mul, aten.sub, aten.exp, aten.clamp, aten.add, aten.log, aten.sum, aten.mean]
# Source node to ATen node mapping:
#   add => add
#   add_1 => add_1
#   exp => exp
#   exp_1 => exp_1
#   exp_2 => exp_3
#   invprobs => abs_1, exp_2, full_default, log1p, minimum, neg_4, sub_3
#   log => log
#   loss => add_2
#   loss_1 => mul_4
#   max_val => clamp_min
#   mean => mean
#   mul => mul
#   mul_1 => mul_1
#   mul_2 => mul_2
#   mul_3 => mul_3
#   neg => neg
#   neg_1 => neg_1
#   neg_2 => neg_2
#   neg_3 => neg_3
#   sub => sub
#   sub_1 => sub_1
#   sub_2 => sub_2
#   sum_1 => sum_1
# Graph fragment:
#   %full_default : [num_users=1] = call_function[target=torch.ops.aten.full.default](args = ([], 0), kwargs = {dtype: torch.float32, layout: torch.strided, device: cuda:0, pin_memory: False})
#   %neg_3 : [num_users=1] = call_function[target=torch.ops.aten.neg.default](args = (%arg1_1,), kwargs = {})
#   %mul_1 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg0_1, 2.0), kwargs = {})
#   %sub_2 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%mul_1, 1.0), kwargs = {})
#   %mul_2 : [num_users=2] = call_function[target=torch.ops.aten.mul.Tensor](args = (%neg_3, %sub_2), kwargs = {})
#   %minimum : [num_users=1] = call_function[target=torch.ops.aten.minimum.default](args = (%full_default, %mul_2), kwargs = {})
#   %abs_1 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%mul_2,), kwargs = {})
#   %neg_4 : [num_users=1] = call_function[target=torch.ops.aten.neg.default](args = (%abs_1,), kwargs = {})
#   %exp_2 : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%neg_4,), kwargs = {})
#   %log1p : [num_users=1] = call_function[target=torch.ops.aten.log1p.default](args = (%exp_2,), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%minimum, %log1p), kwargs = {})
#   %mul_3 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%sub_3, 2), kwargs = {})
#   %exp_3 : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%mul_3,), kwargs = {})
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%arg1_1, %arg0_1), kwargs = {})
#   %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%arg1_1, %mul), kwargs = {})
#   %neg : [num_users=1] = call_function[target=torch.ops.aten.neg.default](args = (%arg1_1,), kwargs = {})
#   %clamp_min : [num_users=3] = call_function[target=torch.ops.aten.clamp_min.default](args = (%neg, 0), kwargs = {})
#   %add : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%sub, %clamp_min), kwargs = {})
#   %neg_1 : [num_users=1] = call_function[target=torch.ops.aten.neg.default](args = (%clamp_min,), kwargs = {})
#   %exp : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%neg_1,), kwargs = {})
#   %neg_2 : [num_users=1] = call_function[target=torch.ops.aten.neg.default](args = (%arg1_1,), kwargs = {})
#   %sub_1 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%neg_2, %clamp_min), kwargs = {})
#   %exp_1 : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%sub_1,), kwargs = {})
#   %add_1 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%exp, %exp_1), kwargs = {})
#   %log : [num_users=1] = call_function[target=torch.ops.aten.log.default](args = (%add_1,), kwargs = {})
#   %add_2 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add, %log), kwargs = {})
#   %mul_4 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%exp_3, %add_2), kwargs = {})
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.dim_IntList](args = (%mul_4, [1]), kwargs = {})
#   %mean : [num_users=1] = call_function[target=torch.ops.aten.mean.default](args = (%sum_1,), kwargs = {})
triton_per_fused_add_clamp_exp_log_log_sigmoid_forward_mean_mul_neg_sub_sum_0 = async_compile.triton('triton_per_fused_add_clamp_exp_log_log_sigmoid_forward_mean_mul_neg_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_clamp_exp_log_log_sigmoid_forward_mean_mul_neg_sub_sum_0', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 8, 'num_reduction': 1, '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_clamp_exp_log_log_sigmoid_forward_mean_mul_neg_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 % 16
    r1 = (rindex // 16)
    r2 = rindex
    tmp0 = tl.load(in_ptr0 + (r0 + (64*r1)), None)
    tmp2 = tl.load(in_ptr1 + (r0 + (64*r1)), None)
    tmp29 = tl.load(in_ptr0 + (16 + r0 + (64*r1)), None)
    tmp31 = tl.load(in_ptr1 + (16 + r0 + (64*r1)), None)
    tmp56 = tl.load(in_ptr0 + (32 + r0 + (64*r1)), None)
    tmp58 = tl.load(in_ptr1 + (32 + r0 + (64*r1)), None)
    tmp83 = tl.load(in_ptr0 + (48 + r0 + (64*r1)), None)
    tmp85 = tl.load(in_ptr1 + (48 + r0 + (64*r1)), None)
    tmp1 = -tmp0
    tmp3 = 2.0
    tmp4 = tmp2 * tmp3
    tmp5 = 1.0
    tmp6 = tmp4 - tmp5
    tmp7 = tmp1 * tmp6
    tmp8 = 0.0
    tmp9 = triton_helpers.minimum(tmp8, tmp7)
    tmp10 = tl_math.abs(tmp7)
    tmp11 = -tmp10
    tmp12 = tl_math.exp(tmp11)
    tmp13 = libdevice.log1p(tmp12)
    tmp14 = tmp9 - tmp13
    tmp15 = tmp14 * tmp3
    tmp16 = tl_math.exp(tmp15)
    tmp17 = tmp0 * tmp2
    tmp18 = tmp0 - tmp17
    tmp19 = triton_helpers.maximum(tmp1, tmp8)
    tmp20 = tmp18 + tmp19
    tmp21 = -tmp19
    tmp22 = tl_math.exp(tmp21)
    tmp23 = tmp1 - tmp19
    tmp24 = tl_math.exp(tmp23)
    tmp25 = tmp22 + tmp24
    tmp26 = tl_math.log(tmp25)
    tmp27 = tmp20 + tmp26
    tmp28 = tmp16 * tmp27
    tmp30 = -tmp29
    tmp32 = tmp31 * tmp3
    tmp33 = tmp32 - tmp5
    tmp34 = tmp30 * tmp33
    tmp35 = triton_helpers.minimum(tmp8, tmp34)
    tmp36 = tl_math.abs(tmp34)
    tmp37 = -tmp36
    tmp38 = tl_math.exp(tmp37)
    tmp39 = libdevice.log1p(tmp38)
    tmp40 = tmp35 - tmp39
    tmp41 = tmp40 * tmp3
    tmp42 = tl_math.exp(tmp41)
    tmp43 = tmp29 * tmp31
    tmp44 = tmp29 - tmp43
    tmp45 = triton_helpers.maximum(tmp30, tmp8)
    tmp46 = tmp44 + tmp45
    tmp47 = -tmp45
    tmp48 = tl_math.exp(tmp47)
    tmp49 = tmp30 - tmp45
    tmp50 = tl_math.exp(tmp49)
    tmp51 = tmp48 + tmp50
    tmp52 = tl_math.log(tmp51)
    tmp53 = tmp46 + tmp52
    tmp54 = tmp42 * tmp53
    tmp55 = tmp28 + tmp54
    tmp57 = -tmp56
    tmp59 = tmp58 * tmp3
    tmp60 = tmp59 - tmp5
    tmp61 = tmp57 * tmp60
    tmp62 = triton_helpers.minimum(tmp8, tmp61)
    tmp63 = tl_math.abs(tmp61)
    tmp64 = -tmp63
    tmp65 = tl_math.exp(tmp64)
    tmp66 = libdevice.log1p(tmp65)
    tmp67 = tmp62 - tmp66
    tmp68 = tmp67 * tmp3
    tmp69 = tl_math.exp(tmp68)
    tmp70 = tmp56 * tmp58
    tmp71 = tmp56 - tmp70
    tmp72 = triton_helpers.maximum(tmp57, tmp8)
    tmp73 = tmp71 + tmp72
    tmp74 = -tmp72
    tmp75 = tl_math.exp(tmp74)
    tmp76 = tmp57 - tmp72
    tmp77 = tl_math.exp(tmp76)
    tmp78 = tmp75 + tmp77
    tmp79 = tl_math.log(tmp78)
    tmp80 = tmp73 + tmp79
    tmp81 = tmp69 * tmp80
    tmp82 = tmp55 + tmp81
    tmp84 = -tmp83
    tmp86 = tmp85 * tmp3
    tmp87 = tmp86 - tmp5
    tmp88 = tmp84 * tmp87
    tmp89 = triton_helpers.minimum(tmp8, tmp88)
    tmp90 = tl_math.abs(tmp88)
    tmp91 = -tmp90
    tmp92 = tl_math.exp(tmp91)
    tmp93 = libdevice.log1p(tmp92)
    tmp94 = tmp89 - tmp93
    tmp95 = tmp94 * tmp3
    tmp96 = tl_math.exp(tmp95)
    tmp97 = tmp83 * tmp85
    tmp98 = tmp83 - tmp97
    tmp99 = triton_helpers.maximum(tmp84, tmp8)
    tmp100 = tmp98 + tmp99
    tmp101 = -tmp99
    tmp102 = tl_math.exp(tmp101)
    tmp103 = tmp84 - tmp99
    tmp104 = tl_math.exp(tmp103)
    tmp105 = tmp102 + tmp104
    tmp106 = tl_math.log(tmp105)
    tmp107 = tmp100 + tmp106
    tmp108 = tmp96 * tmp107
    tmp109 = tmp82 + tmp108
    tmp110 = tl.broadcast_to(tmp109, [XBLOCK, RBLOCK])
    tmp112 = tl.sum(tmp110, 1)[:, None]
    tmp113 = 64.0
    tmp114 = tmp112 / tmp113
    tl.debug_barrier()
    tl.store(in_out_ptr0 + (tl.full([XBLOCK, 1], 0, tl.int32)), tmp114, 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((), (), torch.float32)
        buf2 = buf1; del buf1  # reuse
        # Topologically Sorted Source Nodes: [invprobs, neg_3, mul_1, sub_2, mul_2, mul_3, exp_2, mul, sub, neg, max_val, add, neg_1, exp, neg_2, sub_1, exp_1, add_1, log, loss, loss_1, sum_1, mean], Original ATen: [aten.log_sigmoid_forward, aten.neg, aten.mul, aten.sub, aten.exp, aten.clamp, aten.add, aten.log, aten.sum, aten.mean]
        stream0 = get_raw_stream(0)
        triton_per_fused_add_clamp_exp_log_log_sigmoid_forward_mean_mul_neg_sub_sum_0.run(buf2, arg1_1, arg0_1, 1, 64, grid=grid(1), stream=stream0)
        del arg0_1
        del arg1_1
    return (buf2, )


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


class FocalLoss(torch.nn.Module):

    def __init__(self, gamma=2):
        super().__init__()
        self.gamma = gamma

    def forward(self, input, target):
        if not target.size() == input.size():
            raise ValueError(
                'Target size ({}) must be the same as input size ({})'.
                format(target.size(), input.size()))
        max_val = (-input).clamp(min=0)
        loss = input - input * target + max_val + ((-max_val).exp() + (-
            input - max_val).exp()).log()
        invprobs = F.logsigmoid(-input * (target * 2.0 - 1.0))
        loss = (invprobs * self.gamma).exp() * loss
        return loss.sum(dim=1).mean()


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
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_clamp_exp_log_log_sigmoid_forward_mean_mul_neg_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 % 16
    r1 = rindex // 16
    tmp0 = tl.load(in_ptr0 + (r0 + 64 * r1), None)
    tmp2 = tl.load(in_ptr1 + (r0 + 64 * r1), None)
    tmp29 = tl.load(in_ptr0 + (16 + r0 + 64 * r1), None)
    tmp31 = tl.load(in_ptr1 + (16 + r0 + 64 * r1), None)
    tmp56 = tl.load(in_ptr0 + (32 + r0 + 64 * r1), None)
    tmp58 = tl.load(in_ptr1 + (32 + r0 + 64 * r1), None)
    tmp83 = tl.load(in_ptr0 + (48 + r0 + 64 * r1), None)
    tmp85 = tl.load(in_ptr1 + (48 + r0 + 64 * r1), None)
    tmp1 = -tmp0
    tmp3 = 2.0
    tmp4 = tmp2 * tmp3
    tmp5 = 1.0
    tmp6 = tmp4 - tmp5
    tmp7 = tmp1 * tmp6
    tmp8 = 0.0
    tmp9 = triton_helpers.minimum(tmp8, tmp7)
    tmp10 = tl_math.abs(tmp7)
    tmp11 = -tmp10
    tmp12 = tl_math.exp(tmp11)
    tmp13 = libdevice.log1p(tmp12)
    tmp14 = tmp9 - tmp13
    tmp15 = tmp14 * tmp3
    tmp16 = tl_math.exp(tmp15)
    tmp17 = tmp0 * tmp2
    tmp18 = tmp0 - tmp17
    tmp19 = triton_helpers.maximum(tmp1, tmp8)
    tmp20 = tmp18 + tmp19
    tmp21 = -tmp19
    tmp22 = tl_math.exp(tmp21)
    tmp23 = tmp1 - tmp19
    tmp24 = tl_math.exp(tmp23)
    tmp25 = tmp22 + tmp24
    tmp26 = tl_math.log(tmp25)
    tmp27 = tmp20 + tmp26
    tmp28 = tmp16 * tmp27
    tmp30 = -tmp29
    tmp32 = tmp31 * tmp3
    tmp33 = tmp32 - tmp5
    tmp34 = tmp30 * tmp33
    tmp35 = triton_helpers.minimum(tmp8, tmp34)
    tmp36 = tl_math.abs(tmp34)
    tmp37 = -tmp36
    tmp38 = tl_math.exp(tmp37)
    tmp39 = libdevice.log1p(tmp38)
    tmp40 = tmp35 - tmp39
    tmp41 = tmp40 * tmp3
    tmp42 = tl_math.exp(tmp41)
    tmp43 = tmp29 * tmp31
    tmp44 = tmp29 - tmp43
    tmp45 = triton_helpers.maximum(tmp30, tmp8)
    tmp46 = tmp44 + tmp45
    tmp47 = -tmp45
    tmp48 = tl_math.exp(tmp47)
    tmp49 = tmp30 - tmp45
    tmp50 = tl_math.exp(tmp49)
    tmp51 = tmp48 + tmp50
    tmp52 = tl_math.log(tmp51)
    tmp53 = tmp46 + tmp52
    tmp54 = tmp42 * tmp53
    tmp55 = tmp28 + tmp54
    tmp57 = -tmp56
    tmp59 = tmp58 * tmp3
    tmp60 = tmp59 - tmp5
    tmp61 = tmp57 * tmp60
    tmp62 = triton_helpers.minimum(tmp8, tmp61)
    tmp63 = tl_math.abs(tmp61)
    tmp64 = -tmp63
    tmp65 = tl_math.exp(tmp64)
    tmp66 = libdevice.log1p(tmp65)
    tmp67 = tmp62 - tmp66
    tmp68 = tmp67 * tmp3
    tmp69 = tl_math.exp(tmp68)
    tmp70 = tmp56 * tmp58
    tmp71 = tmp56 - tmp70
    tmp72 = triton_helpers.maximum(tmp57, tmp8)
    tmp73 = tmp71 + tmp72
    tmp74 = -tmp72
    tmp75 = tl_math.exp(tmp74)
    tmp76 = tmp57 - tmp72
    tmp77 = tl_math.exp(tmp76)
    tmp78 = tmp75 + tmp77
    tmp79 = tl_math.log(tmp78)
    tmp80 = tmp73 + tmp79
    tmp81 = tmp69 * tmp80
    tmp82 = tmp55 + tmp81
    tmp84 = -tmp83
    tmp86 = tmp85 * tmp3
    tmp87 = tmp86 - tmp5
    tmp88 = tmp84 * tmp87
    tmp89 = triton_helpers.minimum(tmp8, tmp88)
    tmp90 = tl_math.abs(tmp88)
    tmp91 = -tmp90
    tmp92 = tl_math.exp(tmp91)
    tmp93 = libdevice.log1p(tmp92)
    tmp94 = tmp89 - tmp93
    tmp95 = tmp94 * tmp3
    tmp96 = tl_math.exp(tmp95)
    tmp97 = tmp83 * tmp85
    tmp98 = tmp83 - tmp97
    tmp99 = triton_helpers.maximum(tmp84, tmp8)
    tmp100 = tmp98 + tmp99
    tmp101 = -tmp99
    tmp102 = tl_math.exp(tmp101)
    tmp103 = tmp84 - tmp99
    tmp104 = tl_math.exp(tmp103)
    tmp105 = tmp102 + tmp104
    tmp106 = tl_math.log(tmp105)
    tmp107 = tmp100 + tmp106
    tmp108 = tmp96 * tmp107
    tmp109 = tmp82 + tmp108
    tmp110 = tl.broadcast_to(tmp109, [XBLOCK, RBLOCK])
    tmp112 = tl.sum(tmp110, 1)[:, None]
    tmp113 = 64.0
    tmp114 = tmp112 / tmp113
    tl.debug_barrier()
    tl.store(in_out_ptr0 + tl.full([XBLOCK, 1], 0, tl.int32), tmp114, 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((), (), torch.float32)
        buf2 = buf1
        del buf1
        get_raw_stream(0)
        triton_per_fused_add_clamp_exp_log_log_sigmoid_forward_mean_mul_neg_sub_sum_0[
            grid(1)](buf2, arg1_1, arg0_1, 1, 64, XBLOCK=1, num_warps=2,
            num_stages=1)
        del arg0_1
        del arg1_1
    return buf2,


class FocalLossNew(torch.nn.Module):

    def __init__(self, gamma=2):
        super().__init__()
        self.gamma = gamma

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