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, math as tl_math
import torch as th
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_cat_0(in_ptr0, out_ptr0, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x1 = xindex // 16 % 4
    x0 = xindex % 16
    x2 = xindex // 64
    x3 = xindex
    tmp0 = x1
    tl.full([1], 0, tl.int64)
    tmp3 = tl.full([1], 1, tl.int64)
    tmp4 = tmp0 < tmp3
    tmp5 = tl.load(in_ptr0 + (x0 + 64 * x2), tmp4 & xmask, eviction_policy=
        'evict_last', other=0.0)
    tmp6 = tl_math.sin(tmp5)
    tmp7 = tl.full(tmp6.shape, 0.0, tmp6.dtype)
    tmp8 = tl.where(tmp4, tmp6, tmp7)
    tmp9 = tmp0 >= tmp3
    tmp10 = tl.full([1], 2, tl.int64)
    tmp11 = tmp0 < tmp10
    tmp12 = tmp9 & tmp11
    tmp13 = tl.load(in_ptr0 + (16 + x0 + 64 * x2), tmp12 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp14 = libdevice.tanh(tmp13)
    tmp15 = tl.full(tmp14.shape, 0.0, tmp14.dtype)
    tmp16 = tl.where(tmp12, tmp14, tmp15)
    tmp17 = tmp0 >= tmp10
    tmp18 = tl.full([1], 3, tl.int64)
    tmp19 = tmp0 < tmp18
    tmp20 = tmp17 & tmp19
    tmp21 = tl.load(in_ptr0 + (32 + x0 + 64 * x2), tmp20 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp22 = 0.0
    tmp23 = tmp21 - tmp22
    tmp24 = tmp23 * tmp23
    tmp25 = -tmp24
    tmp26 = 0.5
    tmp27 = tmp25 * tmp26
    tmp28 = tl_math.exp(tmp27)
    tmp29 = tl.full(tmp28.shape, 0.0, tmp28.dtype)
    tmp30 = tl.where(tmp20, tmp28, tmp29)
    tmp31 = tmp0 >= tmp18
    tl.full([1], 4, tl.int64)
    tmp34 = tl.load(in_ptr0 + (48 + x0 + 64 * x2), tmp31 & xmask,
        eviction_policy='evict_last', other=0.0)
    tmp35 = tl.full([1], 0, tl.int32)
    tmp36 = triton_helpers.maximum(tmp35, tmp34)
    tmp37 = tl.full(tmp36.shape, 0.0, tmp36.dtype)
    tmp38 = tl.where(tmp31, tmp36, tmp37)
    tmp39 = tl.where(tmp20, tmp30, tmp38)
    tmp40 = tl.where(tmp12, tmp16, tmp39)
    tmp41 = tl.where(tmp4, tmp8, tmp40)
    tl.store(out_ptr0 + x3, tmp41, xmask)


def call(args):
    arg0_1, = args
    args.clear()
    assert_size_stride(arg0_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_cat_0[grid(256)](arg0_1, buf0, 256, XBLOCK=128,
            num_warps=4, num_stages=1)
        del arg0_1
    return buf0,


def gauss(x, mean=0, std=1):
    return th.exp(-(x - mean) ** 2 / (2 * std ** 2))


class MixActivNew(nn.Module):

    def __init__(self):
        super().__init__()
        self.activations = th.sin, th.tanh, gauss, th.relu
        self.n_activs = len(self.activations)

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


Measured latency_ms: 0.014322