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 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_poi_fused_mul_sum_0(in_ptr0, in_ptr1, out_ptr0, xnumel, XBLOCK:
    tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 4
    x4 = xindex // 16
    x3 = xindex // 64
    x5 = xindex % 16
    x6 = xindex
    tmp0 = tl.load(in_ptr0 + (x0 + 16 * x4), xmask, eviction_policy=
        'evict_last')
    tmp1 = tl.load(in_ptr1 + (x5 + 64 * x3), xmask, eviction_policy=
        'evict_last')
    tmp3 = tl.load(in_ptr0 + (4 + x0 + 16 * x4), xmask, eviction_policy=
        'evict_last')
    tmp4 = tl.load(in_ptr1 + (16 + x5 + 64 * x3), xmask, eviction_policy=
        'evict_last')
    tmp7 = tl.load(in_ptr0 + (8 + x0 + 16 * x4), xmask, eviction_policy=
        'evict_last')
    tmp8 = tl.load(in_ptr1 + (32 + x5 + 64 * x3), xmask, eviction_policy=
        'evict_last')
    tmp11 = tl.load(in_ptr0 + (12 + x0 + 16 * x4), xmask, eviction_policy=
        'evict_last')
    tmp12 = tl.load(in_ptr1 + (48 + x5 + 64 * x3), xmask, eviction_policy=
        'evict_last')
    tmp2 = tmp0 * tmp1
    tmp5 = tmp3 * tmp4
    tmp6 = tmp2 + tmp5
    tmp9 = tmp7 * tmp8
    tmp10 = tmp6 + tmp9
    tmp13 = tmp11 * tmp12
    tmp14 = tmp10 + tmp13
    tl.store(out_ptr0 + x6, tmp14, xmask)


@triton.jit
def triton_poi_fused_div_mul_sum_1(in_ptr0, in_ptr1, out_ptr0, xnumel,
    XBLOCK: tl.constexpr):
    xnumel = 1024
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x4 = xindex % 256
    x0 = xindex % 16
    x5 = xindex // 64
    x6 = xindex
    tmp0 = tl.load(in_ptr0 + x4, xmask, eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + (x0 + 16 * x5), xmask, eviction_policy=
        'evict_last')
    tmp2 = tmp0 / tmp1
    tl.store(out_ptr0 + x6, tmp2, xmask)


def call(args):
    arg0_1, arg1_1, arg2_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))
    assert_size_stride(arg2_1, (4, 4, 4, 4), (64, 16, 4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        get_raw_stream(0)
        triton_poi_fused_mul_sum_0[grid(256)](arg0_1, arg1_1, buf0, 256,
            XBLOCK=128, num_warps=4, num_stages=1)
        del arg0_1
        del arg1_1
        buf1 = empty_strided_cuda((4, 4, 4, 4, 4), (256, 64, 16, 4, 1),
            torch.float32)
        triton_poi_fused_div_mul_sum_1[grid(1024)](buf0, arg2_1, buf1, 1024,
            XBLOCK=128, num_warps=4, num_stages=1)
        del arg2_1
        del buf0
    return buf1,


class MeanPoolingNew(nn.Module):

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

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


Measured latency_ms: 0.028077