```python
import torch
import torch.nn as nn
from torch.utils.cpp_extension import load_inline

_cpp_source = r"""
#include <torch/extension.h>
torch::Tensor fused_gelu_cuda(torch::Tensor x);
"""

_cuda_source = r"""
#include <torch/extension.h>
#include <ATen/AccumulateType.h>
#include <ATen/cuda/CUDAContext.h>
#include <c10/cuda/CUDAGuard.h>
#include <c10/cuda/CUDAException.h>
#include <cuda_runtime.h>
#include <algorithm>
#include <cstdint>

__device__ __forceinline__ float gelu_value(float x) {
    float u = 0.7978845608028654f * (x + 0.044715f * x * x * x);
    return (0.5f * x) * (1.0f + tanhf(u));
}

__device__ __forceinline__ double gelu_value(double x) {
    double u = 0.7978845608028654 * (x + 0.044715 * x * x * x);
    return (0.5 * x) * (1.0 + tanh(u));
}

__global__ void gelu_float4_kernel(
    const float4* __restrict__ x,
    float4* __restrict__ y,
    int64_t count
) {
    int64_t i = int64_t(blockIdx.x) * blockDim.x + threadIdx.x;
    int64_t stride = int64_t(blockDim.x) * gridDim.x;

    for (; i < count; i += stride) {
        float4 v = x[i];
        float4 result;
        result.x = gelu_value(v.x);
        result.y = gelu_value(v.y);
        result.z = gelu_value(v.z);
        result.w = gelu_value(v.w);
        y[i] = result;
    }
}

template <typename scalar_t>
__global__ void gelu_scalar_kernel(
    const scalar_t* __restrict__ x,
    scalar_t* __restrict__ y,
    int64_t count
) {
    using acc_t = at::acc_type<scalar_t, true>;
    int64_t i = int64_t(blockIdx.x) * blockDim.x + threadIdx.x;
    int64_t stride = int64_t(blockDim.x) * gridDim.x;

    for (; i < count; i += stride) {
        y[i] = static_cast<scalar_t>(gelu_value(static_cast<acc_t>(x[i])));
    }
}

torch::Tensor fused_gelu_cuda(torch::Tensor x) {
    TORCH_CHECK(x.is_cuda(), "Input must be a CUDA tensor");
    TORCH_CHECK(x.is_floating_point(), "Input must be floating point");

    c10::cuda::CUDAGuard guard(x.device());
    auto input = x.contiguous();
    auto output = torch::empty_like(input);
    int64_t count = input.numel();
    if (count == 0) {
        return output;
    }

    constexpr int threads = 256;
    cudaStream_t stream = at::cuda::getCurrentCUDAStream();

    if (input.scalar_type() == at::kFloat &&
        count % 4 == 0 &&
        reinterpret_cast<uintptr_t>(input.data_ptr<float>()) % 16 == 0) {
        int64_t vectors = count / 4;
        int blocks = static_cast<int>(
            std::min<int64_t>((vectors + threads - 1) / threads, 4096));
        gelu_float4_kernel<<<blocks, threads, 0, stream>>>(
            reinterpret_cast<const float4*>(input.data_ptr<float>()),
            reinterpret_cast<float4*>(output.data_ptr<float>()),
            vectors);
    } else {
        int blocks = static_cast<int>(
            std::min<int64_t>((count + threads - 1) / threads, 4096));
        AT_DISPATCH_FLOATING_TYPES_AND2(
            at::ScalarType::Half,
            at::ScalarType::BFloat16,
            input.scalar_type(),
            "fused_gelu_cuda",
            [&] {
                gelu_scalar_kernel<scalar_t><<<blocks, threads, 0, stream>>>(
                    input.data_ptr<scalar_t>(),
                    output.data_ptr<scalar_t>(),
                    count);
            });
    }

    C10_CUDA_KERNEL_LAUNCH_CHECK();
    return output;
}
"""

_fused_gelu = load_inline(
    name="fused_tanh_gelu_cuda",
    cpp_sources=_cpp_source,
    cuda_sources=_cuda_source,
    functions=["fused_gelu_cuda"],
    extra_cflags=["-O3"],
    extra_cuda_cflags=["-O3"],
    verbose=False,
)


class ModelNew(nn.Module):
    def __init__(self):
        super().__init__()

    def forward(self, x):
        return _fused_gelu.fused_gelu_cuda(x)
```