import torch
import torch.nn as nn


class MeanVarFC(nn.Module):

    def __init__(self, input_shape):
        super(MeanVarFC, self).__init__()
        shape = list(input_shape)
        shape[0] = 1
        shape[1] *= 2
        self.param = nn.Parameter(0.01 * torch.randn(shape))

    def forward(self, x):
        x = x + self.param
        return x


def get_inputs():
    return [torch.rand([4, 4, 4, 8])]


def get_init_inputs():
    return [[], {'input_shape': [4, 4]}]

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


@triton.jit
def triton_poi_fused_add_0(in_ptr0, in_ptr1, out_ptr0, xnumel, XBLOCK: tl.
    constexpr):
    xnumel = 512
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 8
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr1 + x0, xmask, eviction_policy='evict_last')
    tmp2 = tmp0 + tmp1
    tl.store(out_ptr0 + x2, tmp2, xmask)


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


class MeanVarFCNew(nn.Module):

    def __init__(self, input_shape):
        super(MeanVarFCNew, self).__init__()
        shape = list(input_shape)
        shape[0] = 1
        shape[1] *= 2
        self.param = nn.Parameter(0.01 * torch.randn(shape))

    def forward(self, input_0):
        primals_1 = self.param
        primals_2 = input_0
        output = call([primals_1, primals_2])
        return output[0]
