Write a custom CUDA kernel to optimize `P-GELU` using `float64` (double) precision.

Formula: f(x) = x * (1 + tan(alpha * x + beta * x^3))

Problem Analysis:
1. Precision Issues with float32: The combination of a cubic polynomial and the `tan` function amplifies floating-point rounding errors.
2. Memory Bottleneck: The operation is memory-bound, now with 8 bytes per element.
3. Numerical Stability: The input to `tan` must be clamped to avoid asymptotes.

Optimization Strategy: Fused Element-wise Kernel with Double Precision

1. Data Type: All computations are performed in `double`.

2. Vectorized Loads (double2): Use `double2` to load 128 bits (2 double elements) per memory transaction.

3. Fused Stable Math (in double):
   - For `x`, compute `inner = alpha * x + beta * x*x*x`.
   - Clamp `inner` to stay away from `pi/2`.
   - Compute `result = x * (1.0 + tan(inner))`.
   - Use standard `double` precision math functions (`tan`).

4. One-Pass: Fuse all logic into a single read-compute-write kernel.
  
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
import math

BATCH_SIZE = 4096
HIDDEN_DIM = 4096
SHAPE = (BATCH_SIZE, HIDDEN_DIM)

ALPHA_INIT = 1.0
BETA_INIT = 1.0

DTYPE = torch.float64

class PGELU(nn.Module):
    '''
    P-GELU: A Novel Activation Function to Optimize Whisper for Darija Speech Translation
    https://ieeexplore.ieee.org/document/11016691
    Formula: f(x) = x * (1 + tan(alpha * x + beta * x^3))
    '''
    def __init__(self, alpha_init=1.0, beta_init=1.0):
        super(PGELU, self).__init__()
        self.alpha = nn.Parameter(torch.tensor(alpha_init, dtype=DTYPE))
        self.beta = nn.Parameter(torch.tensor(beta_init, dtype=DTYPE))
        self.pi_half = math.pi / 2.0
        self.eps = 1e-7 # Epsilon for double

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        inner = self.alpha * x + self.beta * x.pow(3)
        inner_clamped = torch.clamp(inner, -self.pi_half + self.eps, self.pi_half - self.eps)
        return x * (1.0 + torch.tan(inner_clamped))

class Model(nn.Module):
    def __init__(self, alpha_init=1.0, beta_init=1.0):
        super(Model, self).__init__()
        self.act = PGELU(alpha_init, beta_init)
    
    def forward(self, x):
        return self.act(x)

def get_inputs():
    input_tensor = torch.randn(SHAPE, dtype=DTYPE)
    return [input_tensor.contiguous()]

def get_init_inputs():
    return [ALPHA_INIT, BETA_INIT]