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
from torch import nn as nn
import torch.nn.parallel
import torch.optim
from torch.autograd import Variable as Variable
import torch.utils.data
import torch._utils
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_div_mean_mul_neg_pow_sqrt_std_sub_sum_0(in_out_ptr0,
    in_ptr0, in_ptr1, xnumel, rnumel):
    XBLOCK: tl.constexpr = 1
    RBLOCK: tl.constexpr = 256
    xoffset = tl.program_id(0) * XBLOCK
    tl.full([1], xoffset, tl.int32)
    tl.full([RBLOCK], True, tl.int1)
    rindex = tl.arange(0, RBLOCK)[:]
    tl.full([RBLOCK], True, tl.int1)
    r0 = rindex
    tmp0 = tl.load(in_ptr0 + r0, None)
    tmp4 = tl.load(in_ptr1 + r0, None)
    tmp1 = tl.broadcast_to(tmp0, [RBLOCK])
    tmp3 = triton_helpers.promote_to_tensor(tl.sum(tmp1, 0))
    tmp5 = tl.broadcast_to(tmp4, [RBLOCK])
    tmp7 = triton_helpers.promote_to_tensor(tl.sum(tmp5, 0))
    tmp8 = 256.0
    tmp9 = tmp3 / tmp8
    tmp10 = tmp0 - tmp9
    tmp11 = tmp7 / tmp8
    tmp12 = tmp4 - tmp11
    tmp13 = tmp10 * tmp12
    tmp14 = tl.broadcast_to(tmp13, [RBLOCK])
    tmp16 = triton_helpers.promote_to_tensor(tl.sum(tmp14, 0))
    tmp17 = tmp10 * tmp10
    tmp18 = tl.broadcast_to(tmp17, [RBLOCK])
    tmp20 = triton_helpers.promote_to_tensor(tl.sum(tmp18, 0))
    tmp21 = tmp12 * tmp12
    tmp22 = tl.broadcast_to(tmp21, [RBLOCK])
    tmp24 = triton_helpers.promote_to_tensor(tl.sum(tmp22, 0))
    tmp26 = tl.broadcast_to(tmp1, [RBLOCK])
    tmp28 = triton_helpers.promote_to_tensor(tl.sum(tmp26, 0))
    tmp29 = tl.full([1], 256, tl.int32)
    tmp30 = tmp29.to(tl.float32)
    tmp31 = tmp28 / tmp30
    tmp32 = tmp1 - tmp31
    tmp33 = tmp32 * tmp32
    tmp34 = tl.broadcast_to(tmp33, [RBLOCK])
    tmp36 = triton_helpers.promote_to_tensor(tl.sum(tmp34, 0))
    tmp38 = tl.broadcast_to(tmp5, [RBLOCK])
    tmp40 = triton_helpers.promote_to_tensor(tl.sum(tmp38, 0))
    tmp41 = tmp40 / tmp30
    tmp42 = tmp5 - tmp41
    tmp43 = tmp42 * tmp42
    tmp44 = tl.broadcast_to(tmp43, [RBLOCK])
    tmp46 = triton_helpers.promote_to_tensor(tl.sum(tmp44, 0))
    tmp47 = libdevice.sqrt(tmp20)
    tmp48 = libdevice.sqrt(tmp24)
    tmp49 = tmp47 * tmp48
    tmp50 = tmp16 / tmp49
    tmp51 = 2.0
    tmp52 = tmp50 * tmp51
    tmp53 = 255.0
    tmp54 = tmp36 / tmp53
    tmp55 = libdevice.sqrt(tmp54)
    tmp56 = tmp52 * tmp55
    tmp57 = tmp46 / tmp53
    tmp58 = libdevice.sqrt(tmp57)
    tmp59 = tmp56 * tmp58
    tmp60 = tmp55 * tmp55
    tmp61 = tmp58 * tmp58
    tmp62 = tmp60 + tmp61
    tmp63 = tmp9 - tmp11
    tmp64 = tmp63 * tmp63
    tmp65 = tmp62 + tmp64
    tmp66 = tmp59 / tmp65
    tmp67 = -tmp66
    tl.debug_barrier()
    tl.store(in_out_ptr0 + tl.full([1], 0, tl.int32), tmp67, 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)
        buf11 = empty_strided_cuda((), (), torch.float32)
        buf13 = buf11
        del buf11
        buf14 = buf13
        del buf13
        get_raw_stream(0)
        triton_per_fused_add_div_mean_mul_neg_pow_sqrt_std_sub_sum_0[grid(1)](
            buf14, arg0_1, arg1_1, 1, 256, num_warps=2, num_stages=1)
        del arg0_1
        del arg1_1
    return buf14,


class My_lossNew(torch.nn.Module):

    def __init__(self):
        super().__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.015076