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 math as tl_math
import torch.nn.modules
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_per_fused_smooth_l1_loss_0(in_out_ptr0, in_ptr0, xnumel, rnumel,
    XBLOCK: tl.constexpr):
    rnumel = 192
    RBLOCK: tl.constexpr = 256
    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, :]
    rmask = rindex < rnumel
    r2 = rindex // 16
    r0 = rindex % 4
    r1 = rindex // 4 % 4
    tmp0 = r2
    tl.full([1, 1], 0, tl.int64)
    tmp3 = tl.full([1, 1], 4, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + tl.broadcast_to(r0 + 16 * r1 + 64 * r2, [
        XBLOCK, RBLOCK]), rmask & tmp4, other=0.0)
    tmp6 = tl.load(in_ptr0 + tl.broadcast_to(4 + r0 + 16 * r1 + 64 * r2, [
        XBLOCK, RBLOCK]), rmask & tmp4, other=0.0)
    tmp7 = tmp5 - tmp6
    tmp8 = tl.full(tmp7.shape, 0.0, tmp7.dtype)
    tmp9 = tl.where(tmp4, tmp7, tmp8)
    tmp10 = tmp0 >= tmp3
    tmp11 = tl.full([1, 1], 8, tl.int64)
    tmp12 = tmp0 < tmp11
    tmp13 = tmp10 & tmp12
    tmp14 = tl.load(in_ptr0 + tl.broadcast_to(4 + r0 + 16 * r1 + 64 * (-4 +
        r2), [XBLOCK, RBLOCK]), rmask & tmp13, other=0.0)
    tmp15 = tl.load(in_ptr0 + tl.broadcast_to(8 + r0 + 16 * r1 + 64 * (-4 +
        r2), [XBLOCK, RBLOCK]), rmask & tmp13, other=0.0)
    tmp16 = tmp14 - tmp15
    tmp17 = tl.full(tmp16.shape, 0.0, tmp16.dtype)
    tmp18 = tl.where(tmp13, tmp16, tmp17)
    tmp19 = tmp0 >= tmp11
    tl.full([1, 1], 12, tl.int64)
    tmp22 = tl.load(in_ptr0 + tl.broadcast_to(8 + r0 + 16 * r1 + 64 * (-8 +
        r2), [XBLOCK, RBLOCK]), rmask & tmp19, other=0.0)
    tmp23 = tl.load(in_ptr0 + tl.broadcast_to(12 + r0 + 16 * r1 + 64 * (-8 +
        r2), [XBLOCK, RBLOCK]), rmask & tmp19, other=0.0)
    tmp24 = tmp22 - tmp23
    tmp25 = tl.full(tmp24.shape, 0.0, tmp24.dtype)
    tmp26 = tl.where(tmp19, tmp24, tmp25)
    tmp27 = tl.where(tmp13, tmp18, tmp26)
    tmp28 = tl.where(tmp4, tmp9, tmp27)
    tmp29 = tl_math.abs(tmp28)
    tmp30 = 1.0
    tmp31 = tmp29 < tmp30
    tmp32 = tmp29 * tmp29
    tmp33 = 0.5
    tmp34 = tmp32 * tmp33
    tmp35 = tmp34 * tmp30
    tmp36 = tmp29 - tmp33
    tmp37 = tl.where(tmp31, tmp35, tmp36)
    tmp38 = tl.broadcast_to(tmp37, [XBLOCK, RBLOCK])
    tmp40 = tl.where(rmask, tmp38, 0)
    tmp41 = tl.sum(tmp40, 1)[:, None]
    tmp42 = 192.0
    tmp43 = tmp41 / tmp42
    tl.debug_barrier()
    tl.store(in_out_ptr0 + tl.full([XBLOCK, 1], 0, tl.int32), tmp43, None)


def call(args):
    arg0_1, = args
    args.clear()
    assert_size_stride(arg0_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_smooth_l1_loss_0[grid(1)](buf2, arg0_1, 1, 192,
            XBLOCK=1, num_warps=2, num_stages=1)
        del arg0_1
    return buf2,


class ParsingRelationLossNew(nn.Module):

    def __init__(self):
        super(ParsingRelationLossNew, self).__init__()

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


Measured latency_ms: 0.014592