Write a custom CUDA kernel to optimize the SmeLU (Smooth ReLU) activation function.

The mathematical definition is:
f(x) = x,                        if x >= beta
f(x) = 0,                        if x <= -beta
f(x) = (x + beta)^2 / (4*beta),  otherwise (|x| < beta)

Problem Analysis:
The reference PyTorch implementation is inefficient due to:
1. Multiple Kernels: It uses two `torch.where` calls, `torch.abs`, arithmetic operations, and tensor creation inside the forward pass. This results in launching multiple kernels.
2. Memory Bandwidth: Each operation creates intermediate tensors, causing redundant global memory reads and writes.
3. Redundant Computation: `torch.where` typically evaluates both branches, meaning the expensive quadratic term might be computed even when not needed.

Optimization Strategy: Fused Branching Kernel with Vectorization

1. Fused Logic: Create a single CUDA kernel that reads input `x` once. Use C++ control flow (`if-else`) to strictly evaluate only the necessary branch for each element.
   - Branch 1: `x >= beta` -> return `x`
   - Branch 2: `x <= -beta` -> return `0`
   - Branch 3: `abs(x) < beta` -> return `(x + beta)^2 * inv_4beta`

2. Constant Pre-computation: The term `1.0 / (4.0 * beta)` is constant for the entire tensor. Pre-compute this on the host or at the start of the kernel to replace division with faster multiplication.

3. Vectorized Access: Use `float4` (128-bit) loads and stores to maximize global memory bandwidth utilization.

4. Grid-Stride Loop: Ensure the kernel handles arbitrary input sizes robustly.
  
Here's an example to show you the syntax of inline embedding custom CUDA operators in torch: The example given architecture is:   
  
```python
import torch
import torch.nn as nn

BATCH_SIZE = 4096
DIM = 4096
SHAPE = (BATCH_SIZE, DIM)
BETA_INIT = 2.0

class SmeLU(nn.Module):
    """
    SmeLU activation function.
    https://arxiv.org/pdf/2202.06499.pdf
    f(x) = x,                        if x >= beta
    f(x) = 0,                        if x <= -beta
    f(x) = (x + beta)^2 / (4*beta),  otherwise (|x| < beta)
    """
    def __init__(self, beta: float = 2.0) -> None:
        super(SmeLU, self).__init__()
        assert beta >= 0., f"Beta must be equal or larger than zero. beta={beta} given."
        self.beta = beta

    def forward(self, input: torch.Tensor) -> torch.Tensor:      
        output = torch.where(input >= self.beta, input, 0.0)
        
        quadratic = ((input + self.beta) ** 2) / (4. * self.beta)
        output = torch.where(torch.abs(input) <= self.beta, quadratic, output)
        
        return output

class Model(nn.Module):
    def __init__(self, beta=2.0):
        super(Model, self).__init__()
        self.act = SmeLU(beta=beta)
    
    def forward(self, x: torch.Tensor) -> torch.Tensor:
        return self.act(x)

def get_inputs():
    # Generate random data in range [-3, 3] to cover all three regions of SmeLU (default beta=2)
    x = torch.randn(SHAPE, dtype=torch.float32) * 3.0
    return [x.contiguous()]

def get_init_inputs():
    return [BETA_INIT]