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
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_abs_add_bitwise_not_div_lt_mean_mul_pow_sub_sum_0(in_ptr0,
    in_ptr1, out_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
    tmp0 = tl.load(in_ptr0 + r0, None)
    tmp1 = tl.load(in_ptr1 + r0, None)
    tmp19 = tl.load(in_ptr0 + (64 + r0), None)
    tmp20 = tl.load(in_ptr1 + (64 + r0), None)
    tmp35 = tl.load(in_ptr0 + (128 + r0), None)
    tmp36 = tl.load(in_ptr1 + (128 + r0), None)
    tmp51 = tl.load(in_ptr0 + (192 + r0), None)
    tmp52 = tl.load(in_ptr1 + (192 + r0), None)
    tmp2 = tmp0 - tmp1
    tmp3 = tl_math.abs(tmp2)
    tmp4 = 0.3
    tmp5 = tmp3 < tmp4
    tmp6 = tmp5.to(tl.float32)
    tmp7 = tmp3 * tmp3
    tmp8 = 0.5
    tmp9 = tmp7 * tmp8
    tmp10 = 3.3333333333333335
    tmp11 = tmp9 * tmp10
    tmp12 = tmp6 * tmp11
    tmp13 = tmp5 == 0
    tmp14 = tmp13.to(tl.float32)
    tmp15 = 0.15
    tmp16 = tmp3 - tmp15
    tmp17 = tmp14 * tmp16
    tmp18 = tmp12 + tmp17
    tmp21 = tmp19 - tmp20
    tmp22 = tl_math.abs(tmp21)
    tmp23 = tmp22 < tmp4
    tmp24 = tmp23.to(tl.float32)
    tmp25 = tmp22 * tmp22
    tmp26 = tmp25 * tmp8
    tmp27 = tmp26 * tmp10
    tmp28 = tmp24 * tmp27
    tmp29 = tmp23 == 0
    tmp30 = tmp29.to(tl.float32)
    tmp31 = tmp22 - tmp15
    tmp32 = tmp30 * tmp31
    tmp33 = tmp28 + tmp32
    tmp34 = tmp18 + tmp33
    tmp37 = tmp35 - tmp36
    tmp38 = tl_math.abs(tmp37)
    tmp39 = tmp38 < tmp4
    tmp40 = tmp39.to(tl.float32)
    tmp41 = tmp38 * tmp38
    tmp42 = tmp41 * tmp8
    tmp43 = tmp42 * tmp10
    tmp44 = tmp40 * tmp43
    tmp45 = tmp39 == 0
    tmp46 = tmp45.to(tl.float32)
    tmp47 = tmp38 - tmp15
    tmp48 = tmp46 * tmp47
    tmp49 = tmp44 + tmp48
    tmp50 = tmp34 + tmp49
    tmp53 = tmp51 - tmp52
    tmp54 = tl_math.abs(tmp53)
    tmp55 = tmp54 < tmp4
    tmp56 = tmp55.to(tl.float32)
    tmp57 = tmp54 * tmp54
    tmp58 = tmp57 * tmp8
    tmp59 = tmp58 * tmp10
    tmp60 = tmp56 * tmp59
    tmp61 = tmp55 == 0
    tmp62 = tmp61.to(tl.float32)
    tmp63 = tmp54 - tmp15
    tmp64 = tmp62 * tmp63
    tmp65 = tmp60 + tmp64
    tmp66 = tmp50 + tmp65
    tmp67 = 4.0
    tmp68 = tmp66 / tmp67
    tmp69 = tl.broadcast_to(tmp68, [XBLOCK, RBLOCK])
    tmp71 = tl.sum(tmp69, 1)[:, None]
    tl.store(out_ptr1 + tl.full([XBLOCK, 1], 0, tl.int32), tmp71, 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)
        get_raw_stream(0)
        triton_per_fused_abs_add_bitwise_not_div_lt_mean_mul_pow_sub_sum_0[grid
            (1)](arg0_1, arg1_1, buf1, 1, 64, XBLOCK=1, num_warps=2,
            num_stages=1)
        del arg0_1
        del arg1_1
    return buf1,


class HuberLossNew(torch.nn.Module):

    def __init__(self, beta=0.3):
        self.beta = beta
        super(HuberLossNew, self).__init__()

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


Measured latency_ms: 0.015401