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.utils.data
import torch
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_per_fused_abs_add_mean_mul_sub_0(in_out_ptr1, in_ptr0, in_ptr1,
    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 + r0, None)
    tmp1 = tl.load(in_ptr1 + r0, None)
    tmp7 = tl.load(in_ptr0 + (16 + r0), None)
    tmp8 = tl.load(in_ptr1 + (16 + r0), None)
    tmp14 = tl.load(in_ptr0 + (144 + r0), None)
    tmp15 = tl.load(in_ptr1 + (144 + r0), None)
    tmp21 = tl.load(in_ptr0 + (32 + r0), None)
    tmp22 = tl.load(in_ptr1 + (32 + r0), None)
    tmp28 = tl.load(in_ptr0 + (160 + r0), None)
    tmp29 = tl.load(in_ptr1 + (160 + r0), None)
    tmp35 = tl.load(in_ptr0 + (64 + r0), None)
    tmp36 = tl.load(in_ptr1 + (64 + r0), None)
    tmp42 = tl.load(in_ptr0 + (192 + r0), None)
    tmp43 = tl.load(in_ptr1 + (192 + r0), None)
    tmp49 = tl.load(in_ptr0 + (80 + r0), None)
    tmp50 = tl.load(in_ptr1 + (80 + r0), None)
    tmp56 = tl.load(in_ptr0 + (208 + r0), None)
    tmp57 = tl.load(in_ptr1 + (208 + r0), None)
    tmp63 = tl.load(in_ptr0 + (96 + r0), None)
    tmp64 = tl.load(in_ptr1 + (96 + r0), None)
    tmp70 = tl.load(in_ptr0 + (224 + r0), None)
    tmp71 = tl.load(in_ptr1 + (224 + r0), None)
    tmp77 = tl.load(in_ptr0 + (128 + r0), None)
    tmp78 = tl.load(in_ptr1 + (128 + r0), None)
    tmp2 = tmp0 - tmp1
    tmp3 = tl_math.abs(tmp2)
    tmp4 = tl.broadcast_to(tmp3, [XBLOCK, RBLOCK])
    tmp6 = tl.sum(tmp4, 1)[:, None]
    tmp9 = tmp7 - tmp8
    tmp10 = tl_math.abs(tmp9)
    tmp11 = tl.broadcast_to(tmp10, [XBLOCK, RBLOCK])
    tmp13 = tl.sum(tmp11, 1)[:, None]
    tmp16 = tmp14 - tmp15
    tmp17 = tl_math.abs(tmp16)
    tmp18 = tl.broadcast_to(tmp17, [XBLOCK, RBLOCK])
    tmp20 = tl.sum(tmp18, 1)[:, None]
    tmp23 = tmp21 - tmp22
    tmp24 = tl_math.abs(tmp23)
    tmp25 = tl.broadcast_to(tmp24, [XBLOCK, RBLOCK])
    tmp27 = tl.sum(tmp25, 1)[:, None]
    tmp30 = tmp28 - tmp29
    tmp31 = tl_math.abs(tmp30)
    tmp32 = tl.broadcast_to(tmp31, [XBLOCK, RBLOCK])
    tmp34 = tl.sum(tmp32, 1)[:, None]
    tmp37 = tmp35 - tmp36
    tmp38 = tl_math.abs(tmp37)
    tmp39 = tl.broadcast_to(tmp38, [XBLOCK, RBLOCK])
    tmp41 = tl.sum(tmp39, 1)[:, None]
    tmp44 = tmp42 - tmp43
    tmp45 = tl_math.abs(tmp44)
    tmp46 = tl.broadcast_to(tmp45, [XBLOCK, RBLOCK])
    tmp48 = tl.sum(tmp46, 1)[:, None]
    tmp51 = tmp49 - tmp50
    tmp52 = tl_math.abs(tmp51)
    tmp53 = tl.broadcast_to(tmp52, [XBLOCK, RBLOCK])
    tmp55 = tl.sum(tmp53, 1)[:, None]
    tmp58 = tmp56 - tmp57
    tmp59 = tl_math.abs(tmp58)
    tmp60 = tl.broadcast_to(tmp59, [XBLOCK, RBLOCK])
    tmp62 = tl.sum(tmp60, 1)[:, None]
    tmp65 = tmp63 - tmp64
    tmp66 = tl_math.abs(tmp65)
    tmp67 = tl.broadcast_to(tmp66, [XBLOCK, RBLOCK])
    tmp69 = tl.sum(tmp67, 1)[:, None]
    tmp72 = tmp70 - tmp71
    tmp73 = tl_math.abs(tmp72)
    tmp74 = tl.broadcast_to(tmp73, [XBLOCK, RBLOCK])
    tmp76 = tl.sum(tmp74, 1)[:, None]
    tmp79 = tmp77 - tmp78
    tmp80 = tl_math.abs(tmp79)
    tmp81 = tl.broadcast_to(tmp80, [XBLOCK, RBLOCK])
    tmp83 = tl.sum(tmp81, 1)[:, None]
    tmp84 = 16.0
    tmp85 = tmp6 / tmp84
    tmp86 = 0.5
    tmp87 = tmp85 * tmp86
    tmp88 = 0.0
    tmp89 = tmp87 + tmp88
    tmp90 = tmp13 / tmp84
    tmp91 = tmp90 * tmp86
    tmp92 = tmp89 + tmp91
    tmp93 = tmp27 / tmp84
    tmp94 = tmp93 * tmp86
    tmp95 = tmp92 + tmp94
    tmp96 = tmp41 / tmp84
    tmp97 = tmp96 * tmp86
    tmp98 = tmp95 + tmp97
    tmp99 = tmp55 / tmp84
    tmp100 = tmp99 * tmp86
    tmp101 = tmp98 + tmp100
    tmp102 = tmp69 / tmp84
    tmp103 = tmp102 * tmp86
    tmp104 = tmp101 + tmp103
    tmp105 = tmp83 / tmp84
    tmp106 = tmp105 * tmp86
    tmp107 = tmp104 + tmp106
    tmp108 = tmp20 / tmp84
    tmp109 = tmp108 * tmp86
    tmp110 = tmp107 + tmp109
    tmp111 = tmp34 / tmp84
    tmp112 = tmp111 * tmp86
    tmp113 = tmp110 + tmp112
    tmp114 = tmp48 / tmp84
    tmp115 = tmp114 * tmp86
    tmp116 = tmp113 + tmp115
    tmp117 = tmp62 / tmp84
    tmp118 = tmp117 * tmp86
    tmp119 = tmp116 + tmp118
    tmp120 = tmp76 / tmp84
    tmp121 = tmp120 * tmp86
    tmp122 = tmp119 + tmp121
    tl.debug_barrier()
    tl.store(in_out_ptr1 + tl.full([XBLOCK, 1], 0, tl.int32), tmp122, 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)
        buf10 = empty_strided_cuda((), (), torch.float32)
        buf13 = buf10
        del buf10
        get_raw_stream(0)
        triton_per_fused_abs_add_mean_mul_sub_0[grid(1)](buf13, arg0_1,
            arg1_1, 1, 16, XBLOCK=1, num_warps=2, num_stages=1)
        del arg0_1
        del arg1_1
    return buf13,


class FeatureMatchingLossNew(nn.Module):

    def __init__(self, n_layers_D, num_D):
        super(FeatureMatchingLossNew, self).__init__()
        self.criterion = nn.L1Loss()
        self.n_layers_D = n_layers_D
        self.num_D = num_D

    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.014925