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 import 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_div_max_mul_sum_0(in_ptr0, in_ptr1, in_ptr2, out_ptr0,
    out_ptr1, xnumel, XBLOCK: tl.constexpr):
    xnumel = 1024
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x0 = xindex % 4
    x2 = xindex // 16 % 4
    x3 = xindex // 64 % 4
    x4 = xindex // 256
    x5 = xindex % 64
    x6 = xindex % 16
    x7 = xindex // 64
    tmp0 = tl.load(in_ptr0 + (x0 + 4 * x2 + 64 * x3), xmask,
        eviction_policy='evict_last')
    tmp1 = tl.load(in_ptr1 + (x5 + 256 * x4), xmask, eviction_policy=
        'evict_last')
    tmp3 = tl.load(in_ptr0 + (16 + x0 + 4 * x2 + 64 * x3), xmask,
        eviction_policy='evict_last')
    tmp4 = tl.load(in_ptr1 + (64 + x5 + 256 * x4), xmask, eviction_policy=
        'evict_last')
    tmp7 = tl.load(in_ptr0 + (32 + x0 + 4 * x2 + 64 * x3), xmask,
        eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr1 + (128 + x5 + 256 * x4), xmask, eviction_policy=
        'evict_last')
    tmp11 = tl.load(in_ptr0 + (48 + x0 + 4 * x2 + 64 * x3), xmask,
        eviction_policy='evict_last')
    tmp12 = tl.load(in_ptr1 + (192 + x5 + 256 * x4), xmask, eviction_policy
        ='evict_last')
    tmp15 = tl.load(in_ptr2 + (x6 + 16 * x7), 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
    tmp16 = tmp14 / tmp15
    tmp17 = triton_helpers.maximum(tmp2, tmp5)
    tmp18 = triton_helpers.maximum(tmp17, tmp9)
    tmp19 = triton_helpers.maximum(tmp18, tmp13)
    tl.store(out_ptr0 + (x5 + 128 * x7), tmp16, xmask)
    tl.store(out_ptr1 + (x5 + 128 * x7), tmp19, 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, 4), (256, 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)
        buf2 = empty_strided_cuda((4, 4, 8, 4, 4), (512, 128, 16, 4, 1),
            torch.float32)
        buf0 = reinterpret_tensor(buf2, (4, 4, 4, 4, 4), (512, 128, 16, 4, 
            1), 64)
        buf1 = reinterpret_tensor(buf2, (4, 4, 4, 4, 4), (512, 128, 16, 4, 
            1), 0)
        get_raw_stream(0)
        triton_poi_fused_div_max_mul_sum_0[grid(1024)](arg0_1, arg1_1,
            arg2_1, buf0, buf1, 1024, XBLOCK=128, num_warps=4, num_stages=1)
        del arg0_1
        del arg1_1
        del arg2_1
    return buf2,


class MeanMaxPoolingNew(nn.Module):

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

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


Measured latency_ms: 0.028594