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
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
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor


@triton.jit
def triton_poi_fused_ne_sum_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 4
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex
    tmp0 = tl.load(in_ptr0 + 16 * x0, xmask, eviction_policy='evict_last')
    tmp4 = tl.load(in_ptr0 + (1 + 16 * x0), xmask, eviction_policy='evict_last'
        )
    tmp8 = tl.load(in_ptr0 + (2 + 16 * x0), xmask, eviction_policy='evict_last'
        )
    tmp12 = tl.load(in_ptr0 + (3 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp19 = tl.load(in_ptr0 + (4 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp22 = tl.load(in_ptr0 + (5 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp26 = tl.load(in_ptr0 + (6 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp30 = tl.load(in_ptr0 + (7 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp37 = tl.load(in_ptr0 + (8 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp40 = tl.load(in_ptr0 + (9 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp44 = tl.load(in_ptr0 + (10 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp48 = tl.load(in_ptr0 + (11 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp55 = tl.load(in_ptr0 + (12 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp58 = tl.load(in_ptr0 + (13 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp62 = tl.load(in_ptr0 + (14 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp66 = tl.load(in_ptr0 + (15 + 16 * x0), xmask, eviction_policy=
        'evict_last')
    tmp1 = 0.0
    tmp2 = tmp0 != tmp1
    tmp3 = tmp2.to(tl.int64)
    tmp5 = tmp4 != tmp1
    tmp6 = tmp5.to(tl.int64)
    tmp7 = tmp3 + tmp6
    tmp9 = tmp8 != tmp1
    tmp10 = tmp9.to(tl.int64)
    tmp11 = tmp7 + tmp10
    tmp13 = tmp12 != tmp1
    tmp14 = tmp13.to(tl.int64)
    tmp15 = tmp11 + tmp14
    tmp16 = tl.full([1], 0, tl.int64)
    tmp17 = tmp15 != tmp16
    tmp18 = tmp17.to(tl.int64)
    tmp20 = tmp19 != tmp1
    tmp21 = tmp20.to(tl.int64)
    tmp23 = tmp22 != tmp1
    tmp24 = tmp23.to(tl.int64)
    tmp25 = tmp21 + tmp24
    tmp27 = tmp26 != tmp1
    tmp28 = tmp27.to(tl.int64)
    tmp29 = tmp25 + tmp28
    tmp31 = tmp30 != tmp1
    tmp32 = tmp31.to(tl.int64)
    tmp33 = tmp29 + tmp32
    tmp34 = tmp33 != tmp16
    tmp35 = tmp34.to(tl.int64)
    tmp36 = tmp18 + tmp35
    tmp38 = tmp37 != tmp1
    tmp39 = tmp38.to(tl.int64)
    tmp41 = tmp40 != tmp1
    tmp42 = tmp41.to(tl.int64)
    tmp43 = tmp39 + tmp42
    tmp45 = tmp44 != tmp1
    tmp46 = tmp45.to(tl.int64)
    tmp47 = tmp43 + tmp46
    tmp49 = tmp48 != tmp1
    tmp50 = tmp49.to(tl.int64)
    tmp51 = tmp47 + tmp50
    tmp52 = tmp51 != tmp16
    tmp53 = tmp52.to(tl.int64)
    tmp54 = tmp36 + tmp53
    tmp56 = tmp55 != tmp1
    tmp57 = tmp56.to(tl.int64)
    tmp59 = tmp58 != tmp1
    tmp60 = tmp59.to(tl.int64)
    tmp61 = tmp57 + tmp60
    tmp63 = tmp62 != tmp1
    tmp64 = tmp63.to(tl.int64)
    tmp65 = tmp61 + tmp64
    tmp67 = tmp66 != tmp1
    tmp68 = tmp67.to(tl.int64)
    tmp69 = tmp65 + tmp68
    tmp70 = tmp69 != tmp16
    tmp71 = tmp70.to(tl.int64)
    tmp72 = tmp54 + tmp71
    tl.store(out_ptr0 + x0, tmp72, xmask)


@triton.jit
def triton_poi_fused__to_copy_div_sum_1(in_ptr0, in_ptr1, out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 16
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 4
    x1 = xindex // 4
    x2 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + 16 * x1), xmask)
    tmp1 = tl.load(in_ptr0 + (4 + x0 + 16 * x1), xmask)
    tmp3 = tl.load(in_ptr0 + (8 + x0 + 16 * x1), xmask)
    tmp5 = tl.load(in_ptr0 + (12 + x0 + 16 * x1), xmask)
    tmp7 = tl.load(in_ptr1 + x1, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tmp4 = tmp2 + tmp3
    tmp6 = tmp4 + tmp5
    tmp8 = tmp7.to(tl.float32)
    tmp9 = tmp6 / tmp8
    tl.store(out_ptr0 + x2, tmp9, 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,), (1,), torch.int64)
        get_raw_stream(0)
        triton_poi_fused_ne_sum_0[grid(4)](arg0_1, buf0, 4, XBLOCK=4,
            num_warps=1, num_stages=1)
        buf1 = empty_strided_cuda((4, 4), (4, 1), torch.float32)
        triton_poi_fused__to_copy_div_sum_1[grid(16)](arg0_1, buf0, buf1, 
            16, XBLOCK=16, num_warps=1, num_stages=1)
        del arg0_1
        del buf0
    return reinterpret_tensor(buf1, (4, 4, 4), (4, 0, 1), 0),


class AspectMeanNew(nn.Module):

    def __init__(self, max_sen_len):
        """
        :param max_sen_len: maximum length of sentence
        """
        super(AspectMeanNew, self).__init__()
        self.max_sen_len = max_sen_len

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


Measured latency_ms: 0.027675