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
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_poi_fused_cat_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 32
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 8
    x1 = xindex // 8
    x2 = xindex
    tmp0 = x0
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 4, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + (16 * x1 + x0), tmp4 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp6 = tl.load(in_ptr0 + (4 + 16 * x1 + x0), tmp4 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp7 = tmp5 + tmp6
    tmp8 = tl.load(in_ptr0 + (8 + 16 * x1 + x0), tmp4 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp9 = tmp7 + tmp8
    tmp10 = tl.load(in_ptr0 + (12 + 16 * x1 + x0), tmp4 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp11 = tmp9 + tmp10
    tmp12 = 4.0
    tmp13 = tmp11 / tmp12
    tmp14 = tl.full(tmp13.shape, 0.0, tmp13.dtype)
    tmp15 = tl.where(tmp4, tmp13, tmp14)
    tmp16 = tmp0 >= tmp3
    tl.full([1], 8, tl.int64)
    tmp19 = tl.load(in_ptr0 + (16 * x1 + (-4 + x0)), tmp16 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp20 = tl.load(in_ptr0 + (4 + 16 * x1 + (-4 + x0)), tmp16 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp21 = tmp19 + tmp20
    tmp22 = tl.load(in_ptr0 + (8 + 16 * x1 + (-4 + x0)), tmp16 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp23 = tmp21 + tmp22
    tmp24 = tl.load(in_ptr0 + (12 + 16 * x1 + (-4 + x0)), tmp16 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp25 = tmp23 + tmp24
    tmp26 = tmp25 / tmp12
    tmp27 = tmp19 - tmp26
    tmp28 = tmp27 * tmp27
    tmp29 = tmp20 - tmp26
    tmp30 = tmp29 * tmp29
    tmp31 = tmp28 + tmp30
    tmp32 = tmp22 - tmp26
    tmp33 = tmp32 * tmp32
    tmp34 = tmp31 + tmp33
    tmp35 = tmp24 - tmp26
    tmp36 = tmp35 * tmp35
    tmp37 = tmp34 + tmp36
    tmp38 = 1e-10
    tmp39 = triton_helpers.maximum(tmp37, tmp38)
    tmp40 = 0.25
    tmp41 = tmp39 * tmp40
    tmp42 = libdevice.sqrt(tmp41)
    tmp43 = tl.full(tmp42.shape, 0.0, tmp42.dtype)
    tmp44 = tl.where(tmp16, tmp42, tmp43)
    tmp45 = tl.where(tmp4, tmp15, tmp44)
    tl.store(out_ptr0 + x2, tmp45, xmask)


def call(args):
    arg0_1, = args
    args.clear()
    assert_size_stride(arg0_1, (4, 4, 4), (16, 4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 8), (8, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_cat_0[grid(32)](arg0_1, buf0, 32, XBLOCK=32,
            num_warps=1, num_stages=1)
        del arg0_1
    return buf0,


class StatsPoolNew(nn.Module):

    def __init__(self, floor=1e-10, bessel=False):
        super(StatsPoolNew, self).__init__()
        self.floor = floor
        self.bessel = bessel

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


Measured latency_ms: 0.01425