# 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_7/inductor_cache/65/c65zpusbnk7z2du6adpqk6pfszzkt73zztao77czgocyqqfvfe43.py
# Topologically Sorted Source Nodes: [l1_loss, loss_1, l1_loss_1, loss_2, l1_loss_2, loss_3, l1_loss_3, loss_4, l1_loss_4, loss_5, l1_loss_5, loss_6, l1_loss_6, loss_7, l1_loss_7, loss_8, l1_loss_8, loss_9, l1_loss_9, loss_10, l1_loss_10, loss_11, l1_loss_11, loss_12, l1_loss_12, loss_13, l1_loss_13, loss_14, l1_loss_14, loss_15, l1_loss_15, loss_16, l1_loss_16, loss_17, l1_loss_17, loss_18, loss_19], Original ATen: [aten.sub, aten.abs, aten.add, aten.sum, aten.div]
# Source node to ATen node mapping:
#   l1_loss => abs_1, sub
#   l1_loss_1 => abs_2, sub_1, sum_2
#   l1_loss_10 => abs_11, sub_10, sum_11
#   l1_loss_11 => abs_12, sub_11, sum_12
#   l1_loss_12 => abs_13, sub_12, sum_13
#   l1_loss_13 => abs_14, sub_13, sum_14
#   l1_loss_14 => abs_15, sub_14, sum_15
#   l1_loss_15 => abs_16, sub_15, sum_16
#   l1_loss_16 => abs_17, sub_16, sum_17
#   l1_loss_17 => abs_18, sub_17, sum_18
#   l1_loss_2 => abs_3, sub_2, sum_3
#   l1_loss_3 => abs_4, sub_3, sum_4
#   l1_loss_4 => abs_5, sub_4, sum_5
#   l1_loss_5 => abs_6, sub_5, sum_6
#   l1_loss_6 => abs_7, sub_6, sum_7
#   l1_loss_7 => abs_8, sub_7, sum_8
#   l1_loss_8 => abs_9, sub_8, sum_9
#   l1_loss_9 => abs_10, sub_9, sum_10
#   loss_1 => sum_1
#   loss_10 => add_9
#   loss_11 => add_10
#   loss_12 => add_11
#   loss_13 => add_12
#   loss_14 => add_13
#   loss_15 => add_14
#   loss_16 => add_15
#   loss_17 => add_16
#   loss_18 => add_17
#   loss_19 => div
#   loss_2 => add_1
#   loss_3 => add_2
#   loss_4 => add_3
#   loss_5 => add_4
#   loss_6 => add_5
#   loss_7 => add_6
#   loss_8 => add_7
#   loss_9 => add_8
# Graph fragment:
#   %sub : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_1, %select_3), kwargs = {})
#   %abs_1 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub,), kwargs = {})
#   %sum_1 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_1,), kwargs = {})
#   %sub_1 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_5, %select_7), kwargs = {})
#   %abs_2 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_1,), kwargs = {})
#   %sum_2 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_2,), kwargs = {})
#   %add_1 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%sum_1, %sum_2), kwargs = {})
#   %sub_2 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_9, %select_11), kwargs = {})
#   %abs_3 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_2,), kwargs = {})
#   %sum_3 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_3,), kwargs = {})
#   %add_2 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_1, %sum_3), kwargs = {})
#   %sub_3 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_13, %select_15), kwargs = {})
#   %abs_4 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_3,), kwargs = {})
#   %sum_4 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_4,), kwargs = {})
#   %add_3 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_2, %sum_4), kwargs = {})
#   %sub_4 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_17, %select_19), kwargs = {})
#   %abs_5 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_4,), kwargs = {})
#   %sum_5 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_5,), kwargs = {})
#   %add_4 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_3, %sum_5), kwargs = {})
#   %sub_5 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_21, %select_23), kwargs = {})
#   %abs_6 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_5,), kwargs = {})
#   %sum_6 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_6,), kwargs = {})
#   %add_5 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_4, %sum_6), kwargs = {})
#   %sub_6 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_25, %select_27), kwargs = {})
#   %abs_7 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_6,), kwargs = {})
#   %sum_7 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_7,), kwargs = {})
#   %add_6 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_5, %sum_7), kwargs = {})
#   %sub_7 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_29, %select_31), kwargs = {})
#   %abs_8 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_7,), kwargs = {})
#   %sum_8 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_8,), kwargs = {})
#   %add_7 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_6, %sum_8), kwargs = {})
#   %sub_8 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_33, %select_35), kwargs = {})
#   %abs_9 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_8,), kwargs = {})
#   %sum_9 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_9,), kwargs = {})
#   %add_8 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_7, %sum_9), kwargs = {})
#   %sub_9 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_37, %select_39), kwargs = {})
#   %abs_10 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_9,), kwargs = {})
#   %sum_10 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_10,), kwargs = {})
#   %add_9 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_8, %sum_10), kwargs = {})
#   %sub_10 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_41, %select_43), kwargs = {})
#   %abs_11 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_10,), kwargs = {})
#   %sum_11 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_11,), kwargs = {})
#   %add_10 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_9, %sum_11), kwargs = {})
#   %sub_11 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_45, %select_47), kwargs = {})
#   %abs_12 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_11,), kwargs = {})
#   %sum_12 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_12,), kwargs = {})
#   %add_11 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_10, %sum_12), kwargs = {})
#   %sub_12 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_49, %select_51), kwargs = {})
#   %abs_13 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_12,), kwargs = {})
#   %sum_13 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_13,), kwargs = {})
#   %add_12 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_11, %sum_13), kwargs = {})
#   %sub_13 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_53, %select_55), kwargs = {})
#   %abs_14 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_13,), kwargs = {})
#   %sum_14 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_14,), kwargs = {})
#   %add_13 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_12, %sum_14), kwargs = {})
#   %sub_14 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_57, %select_59), kwargs = {})
#   %abs_15 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_14,), kwargs = {})
#   %sum_15 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_15,), kwargs = {})
#   %add_14 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_13, %sum_15), kwargs = {})
#   %sub_15 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_61, %select_63), kwargs = {})
#   %abs_16 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_15,), kwargs = {})
#   %sum_16 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_16,), kwargs = {})
#   %add_15 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_14, %sum_16), kwargs = {})
#   %sub_16 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_65, %select_67), kwargs = {})
#   %abs_17 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_16,), kwargs = {})
#   %sum_17 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_17,), kwargs = {})
#   %add_16 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_15, %sum_17), kwargs = {})
#   %sub_17 : [num_users=1] = call_function[target=torch.ops.aten.sub.Tensor](args = (%select_69, %select_71), kwargs = {})
#   %abs_18 : [num_users=1] = call_function[target=torch.ops.aten.abs.default](args = (%sub_17,), kwargs = {})
#   %sum_18 : [num_users=1] = call_function[target=torch.ops.aten.sum.default](args = (%abs_18,), kwargs = {})
#   %add_17 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_16, %sum_18), kwargs = {})
#   %div : [num_users=1] = call_function[target=torch.ops.aten.div.Tensor](args = (%add_17, 16), kwargs = {})
triton_per_fused_abs_add_div_sub_sum_0 = async_compile.triton('triton_per_fused_abs_add_div_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, 16],
    reduction_hint=ReductionHint.INNER,
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: 'i32', 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': {2: 1}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 3), equal_to_1=(2,))]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_per_fused_abs_add_div_sub_sum_0', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 15, 'num_reduction': 18, '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_sub_sum_0(in_out_ptr0, in_ptr0, xnumel, rnumel, XBLOCK : tl.constexpr):
    xnumel = 1
    rnumel = 16
    RBLOCK: tl.constexpr = 16
    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
    tmp0 = tl.load(in_ptr0 + (16*r0), None, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr0 + (4 + (16*r0)), None, eviction_policy='evict_last')
    tmp7 = tl.load(in_ptr0 + (1 + (16*r0)), None, eviction_policy='evict_last')
    tmp13 = tl.load(in_ptr0 + (5 + (16*r0)), None, eviction_policy='evict_last')
    tmp19 = tl.load(in_ptr0 + (2 + (16*r0)), None, eviction_policy='evict_last')
    tmp25 = tl.load(in_ptr0 + (6 + (16*r0)), None, eviction_policy='evict_last')
    tmp31 = tl.load(in_ptr0 + (3 + (16*r0)), None, eviction_policy='evict_last')
    tmp37 = tl.load(in_ptr0 + (8 + (16*r0)), None, eviction_policy='evict_last')
    tmp48 = tl.load(in_ptr0 + (9 + (16*r0)), None, eviction_policy='evict_last')
    tmp59 = tl.load(in_ptr0 + (10 + (16*r0)), None, eviction_policy='evict_last')
    tmp65 = tl.load(in_ptr0 + (7 + (16*r0)), None, eviction_policy='evict_last')
    tmp71 = tl.load(in_ptr0 + (12 + (16*r0)), None, eviction_policy='evict_last')
    tmp82 = tl.load(in_ptr0 + (13 + (16*r0)), None, eviction_policy='evict_last')
    tmp93 = tl.load(in_ptr0 + (14 + (16*r0)), None, eviction_policy='evict_last')
    tmp99 = tl.load(in_ptr0 + (11 + (16*r0)), None, eviction_policy='evict_last')
    tmp2 = tmp0 - tmp1
    tmp3 = tl_math.abs(tmp2)
    tmp4 = tl.broadcast_to(tmp3, [XBLOCK, RBLOCK])
    tmp6 = tl.sum(tmp4, 1)[:, None]
    tmp8 = tmp0 - tmp7
    tmp9 = tl_math.abs(tmp8)
    tmp10 = tl.broadcast_to(tmp9, [XBLOCK, RBLOCK])
    tmp12 = tl.sum(tmp10, 1)[:, None]
    tmp14 = tmp7 - tmp13
    tmp15 = tl_math.abs(tmp14)
    tmp16 = tl.broadcast_to(tmp15, [XBLOCK, RBLOCK])
    tmp18 = tl.sum(tmp16, 1)[:, None]
    tmp20 = tmp7 - tmp19
    tmp21 = tl_math.abs(tmp20)
    tmp22 = tl.broadcast_to(tmp21, [XBLOCK, RBLOCK])
    tmp24 = tl.sum(tmp22, 1)[:, None]
    tmp26 = tmp19 - tmp25
    tmp27 = tl_math.abs(tmp26)
    tmp28 = tl.broadcast_to(tmp27, [XBLOCK, RBLOCK])
    tmp30 = tl.sum(tmp28, 1)[:, None]
    tmp32 = tmp19 - tmp31
    tmp33 = tl_math.abs(tmp32)
    tmp34 = tl.broadcast_to(tmp33, [XBLOCK, RBLOCK])
    tmp36 = tl.sum(tmp34, 1)[:, None]
    tmp38 = tmp1 - tmp37
    tmp39 = tl_math.abs(tmp38)
    tmp40 = tl.broadcast_to(tmp39, [XBLOCK, RBLOCK])
    tmp42 = tl.sum(tmp40, 1)[:, None]
    tmp43 = tmp1 - tmp13
    tmp44 = tl_math.abs(tmp43)
    tmp45 = tl.broadcast_to(tmp44, [XBLOCK, RBLOCK])
    tmp47 = tl.sum(tmp45, 1)[:, None]
    tmp49 = tmp13 - tmp48
    tmp50 = tl_math.abs(tmp49)
    tmp51 = tl.broadcast_to(tmp50, [XBLOCK, RBLOCK])
    tmp53 = tl.sum(tmp51, 1)[:, None]
    tmp54 = tmp13 - tmp25
    tmp55 = tl_math.abs(tmp54)
    tmp56 = tl.broadcast_to(tmp55, [XBLOCK, RBLOCK])
    tmp58 = tl.sum(tmp56, 1)[:, None]
    tmp60 = tmp25 - tmp59
    tmp61 = tl_math.abs(tmp60)
    tmp62 = tl.broadcast_to(tmp61, [XBLOCK, RBLOCK])
    tmp64 = tl.sum(tmp62, 1)[:, None]
    tmp66 = tmp25 - tmp65
    tmp67 = tl_math.abs(tmp66)
    tmp68 = tl.broadcast_to(tmp67, [XBLOCK, RBLOCK])
    tmp70 = tl.sum(tmp68, 1)[:, None]
    tmp72 = tmp37 - tmp71
    tmp73 = tl_math.abs(tmp72)
    tmp74 = tl.broadcast_to(tmp73, [XBLOCK, RBLOCK])
    tmp76 = tl.sum(tmp74, 1)[:, None]
    tmp77 = tmp37 - tmp48
    tmp78 = tl_math.abs(tmp77)
    tmp79 = tl.broadcast_to(tmp78, [XBLOCK, RBLOCK])
    tmp81 = tl.sum(tmp79, 1)[:, None]
    tmp83 = tmp48 - tmp82
    tmp84 = tl_math.abs(tmp83)
    tmp85 = tl.broadcast_to(tmp84, [XBLOCK, RBLOCK])
    tmp87 = tl.sum(tmp85, 1)[:, None]
    tmp88 = tmp48 - tmp59
    tmp89 = tl_math.abs(tmp88)
    tmp90 = tl.broadcast_to(tmp89, [XBLOCK, RBLOCK])
    tmp92 = tl.sum(tmp90, 1)[:, None]
    tmp94 = tmp59 - tmp93
    tmp95 = tl_math.abs(tmp94)
    tmp96 = tl.broadcast_to(tmp95, [XBLOCK, RBLOCK])
    tmp98 = tl.sum(tmp96, 1)[:, None]
    tmp100 = tmp59 - tmp99
    tmp101 = tl_math.abs(tmp100)
    tmp102 = tl.broadcast_to(tmp101, [XBLOCK, RBLOCK])
    tmp104 = tl.sum(tmp102, 1)[:, None]
    tmp105 = tmp6 + tmp12
    tmp106 = tmp105 + tmp18
    tmp107 = tmp106 + tmp24
    tmp108 = tmp107 + tmp30
    tmp109 = tmp108 + tmp36
    tmp110 = tmp109 + tmp42
    tmp111 = tmp110 + tmp47
    tmp112 = tmp111 + tmp53
    tmp113 = tmp112 + tmp58
    tmp114 = tmp113 + tmp64
    tmp115 = tmp114 + tmp70
    tmp116 = tmp115 + tmp76
    tmp117 = tmp116 + tmp81
    tmp118 = tmp117 + tmp87
    tmp119 = tmp118 + tmp92
    tmp120 = tmp119 + tmp98
    tmp121 = tmp120 + tmp104
    tmp122 = 0.0625
    tmp123 = tmp121 * tmp122
    tl.debug_barrier()
    tl.store(in_out_ptr0 + (tl.full([XBLOCK, 1], 0, tl.int32)), tmp123, None)
''', device_str='cuda')


async_compile.wait(globals())
del async_compile

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)
        buf0 = empty_strided_cuda((), (), torch.float32)
        buf16 = buf0; del buf0  # reuse
        buf19 = buf16; del buf16  # reuse
        # Topologically Sorted Source Nodes: [l1_loss, loss_1, l1_loss_1, loss_2, l1_loss_2, loss_3, l1_loss_3, loss_4, l1_loss_4, loss_5, l1_loss_5, loss_6, l1_loss_6, loss_7, l1_loss_7, loss_8, l1_loss_8, loss_9, l1_loss_9, loss_10, l1_loss_10, loss_11, l1_loss_11, loss_12, l1_loss_12, loss_13, l1_loss_13, loss_14, l1_loss_14, loss_15, l1_loss_15, loss_16, l1_loss_16, loss_17, l1_loss_17, loss_18, loss_19], Original ATen: [aten.sub, aten.abs, aten.add, aten.sum, aten.div]
        stream0 = get_raw_stream(0)
        triton_per_fused_abs_add_div_sub_sum_0.run(buf19, arg0_1, 1, 16, grid=grid(1), stream=stream0)
        del arg0_1
    return (buf19, )


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)
    fn = lambda: call([arg0_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 as nn
import torch.nn.functional as F


class SmoothnessLoss(nn.Module):

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

    def forward(self, pred_label):
        _n, _c, w, h = pred_label.size()
        loss = torch.tensor(0.0, device=pred_label.device)
        for i in range(w - 1):
            for j in range(h - 1):
                loss += F.l1_loss(pred_label[:, :, i, j], pred_label[:, :, 
                    i + 1, j], reduction='sum')
                loss += F.l1_loss(pred_label[:, :, i, j], pred_label[:, :,
                    i, j + 1], reduction='sum')
        loss /= w * h
        return loss


def get_inputs():
    return [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.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


@triton.jit
def triton_per_fused_abs_add_div_sub_sum_0(in_out_ptr0, in_ptr0, xnumel,
    rnumel, XBLOCK: tl.constexpr):
    RBLOCK: tl.constexpr = 16
    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 + 16 * r0, None, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr0 + (4 + 16 * r0), None, eviction_policy='evict_last')
    tmp7 = tl.load(in_ptr0 + (1 + 16 * r0), None, eviction_policy='evict_last')
    tmp13 = tl.load(in_ptr0 + (5 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp19 = tl.load(in_ptr0 + (2 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp25 = tl.load(in_ptr0 + (6 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp31 = tl.load(in_ptr0 + (3 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp37 = tl.load(in_ptr0 + (8 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp48 = tl.load(in_ptr0 + (9 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp59 = tl.load(in_ptr0 + (10 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp65 = tl.load(in_ptr0 + (7 + 16 * r0), None, eviction_policy='evict_last'
        )
    tmp71 = tl.load(in_ptr0 + (12 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp82 = tl.load(in_ptr0 + (13 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp93 = tl.load(in_ptr0 + (14 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp99 = tl.load(in_ptr0 + (11 + 16 * r0), None, eviction_policy=
        'evict_last')
    tmp2 = tmp0 - tmp1
    tmp3 = tl_math.abs(tmp2)
    tmp4 = tl.broadcast_to(tmp3, [XBLOCK, RBLOCK])
    tmp6 = tl.sum(tmp4, 1)[:, None]
    tmp8 = tmp0 - tmp7
    tmp9 = tl_math.abs(tmp8)
    tmp10 = tl.broadcast_to(tmp9, [XBLOCK, RBLOCK])
    tmp12 = tl.sum(tmp10, 1)[:, None]
    tmp14 = tmp7 - tmp13
    tmp15 = tl_math.abs(tmp14)
    tmp16 = tl.broadcast_to(tmp15, [XBLOCK, RBLOCK])
    tmp18 = tl.sum(tmp16, 1)[:, None]
    tmp20 = tmp7 - tmp19
    tmp21 = tl_math.abs(tmp20)
    tmp22 = tl.broadcast_to(tmp21, [XBLOCK, RBLOCK])
    tmp24 = tl.sum(tmp22, 1)[:, None]
    tmp26 = tmp19 - tmp25
    tmp27 = tl_math.abs(tmp26)
    tmp28 = tl.broadcast_to(tmp27, [XBLOCK, RBLOCK])
    tmp30 = tl.sum(tmp28, 1)[:, None]
    tmp32 = tmp19 - tmp31
    tmp33 = tl_math.abs(tmp32)
    tmp34 = tl.broadcast_to(tmp33, [XBLOCK, RBLOCK])
    tmp36 = tl.sum(tmp34, 1)[:, None]
    tmp38 = tmp1 - tmp37
    tmp39 = tl_math.abs(tmp38)
    tmp40 = tl.broadcast_to(tmp39, [XBLOCK, RBLOCK])
    tmp42 = tl.sum(tmp40, 1)[:, None]
    tmp43 = tmp1 - tmp13
    tmp44 = tl_math.abs(tmp43)
    tmp45 = tl.broadcast_to(tmp44, [XBLOCK, RBLOCK])
    tmp47 = tl.sum(tmp45, 1)[:, None]
    tmp49 = tmp13 - tmp48
    tmp50 = tl_math.abs(tmp49)
    tmp51 = tl.broadcast_to(tmp50, [XBLOCK, RBLOCK])
    tmp53 = tl.sum(tmp51, 1)[:, None]
    tmp54 = tmp13 - tmp25
    tmp55 = tl_math.abs(tmp54)
    tmp56 = tl.broadcast_to(tmp55, [XBLOCK, RBLOCK])
    tmp58 = tl.sum(tmp56, 1)[:, None]
    tmp60 = tmp25 - tmp59
    tmp61 = tl_math.abs(tmp60)
    tmp62 = tl.broadcast_to(tmp61, [XBLOCK, RBLOCK])
    tmp64 = tl.sum(tmp62, 1)[:, None]
    tmp66 = tmp25 - tmp65
    tmp67 = tl_math.abs(tmp66)
    tmp68 = tl.broadcast_to(tmp67, [XBLOCK, RBLOCK])
    tmp70 = tl.sum(tmp68, 1)[:, None]
    tmp72 = tmp37 - tmp71
    tmp73 = tl_math.abs(tmp72)
    tmp74 = tl.broadcast_to(tmp73, [XBLOCK, RBLOCK])
    tmp76 = tl.sum(tmp74, 1)[:, None]
    tmp77 = tmp37 - tmp48
    tmp78 = tl_math.abs(tmp77)
    tmp79 = tl.broadcast_to(tmp78, [XBLOCK, RBLOCK])
    tmp81 = tl.sum(tmp79, 1)[:, None]
    tmp83 = tmp48 - tmp82
    tmp84 = tl_math.abs(tmp83)
    tmp85 = tl.broadcast_to(tmp84, [XBLOCK, RBLOCK])
    tmp87 = tl.sum(tmp85, 1)[:, None]
    tmp88 = tmp48 - tmp59
    tmp89 = tl_math.abs(tmp88)
    tmp90 = tl.broadcast_to(tmp89, [XBLOCK, RBLOCK])
    tmp92 = tl.sum(tmp90, 1)[:, None]
    tmp94 = tmp59 - tmp93
    tmp95 = tl_math.abs(tmp94)
    tmp96 = tl.broadcast_to(tmp95, [XBLOCK, RBLOCK])
    tmp98 = tl.sum(tmp96, 1)[:, None]
    tmp100 = tmp59 - tmp99
    tmp101 = tl_math.abs(tmp100)
    tmp102 = tl.broadcast_to(tmp101, [XBLOCK, RBLOCK])
    tmp104 = tl.sum(tmp102, 1)[:, None]
    tmp105 = tmp6 + tmp12
    tmp106 = tmp105 + tmp18
    tmp107 = tmp106 + tmp24
    tmp108 = tmp107 + tmp30
    tmp109 = tmp108 + tmp36
    tmp110 = tmp109 + tmp42
    tmp111 = tmp110 + tmp47
    tmp112 = tmp111 + tmp53
    tmp113 = tmp112 + tmp58
    tmp114 = tmp113 + tmp64
    tmp115 = tmp114 + tmp70
    tmp116 = tmp115 + tmp76
    tmp117 = tmp116 + tmp81
    tmp118 = tmp117 + tmp87
    tmp119 = tmp118 + tmp92
    tmp120 = tmp119 + tmp98
    tmp121 = tmp120 + tmp104
    tmp122 = 0.0625
    tmp123 = tmp121 * tmp122
    tl.debug_barrier()
    tl.store(in_out_ptr0 + tl.full([XBLOCK, 1], 0, tl.int32), tmp123, 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)
        buf0 = empty_strided_cuda((), (), torch.float32)
        buf16 = buf0
        del buf0
        buf19 = buf16
        del buf16
        get_raw_stream(0)
        triton_per_fused_abs_add_div_sub_sum_0[grid(1)](buf19, arg0_1, 1, 
            16, XBLOCK=1, num_warps=2, num_stages=1)
        del arg0_1
    return buf19,


class SmoothnessLossNew(nn.Module):

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

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