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


_cpp_source = r"""
#include <torch/extension.h>
torch::Tensor fused_epilogue_cuda(
    torch::Tensor x, torch::Tensor bias, torch::Tensor addition);
"""

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

__device__ __forceinline__ float activate(
    float x, float bias, float addition
) {
    x = __fadd_rn(x, bias);
    x = x > 0.0f ? x : __fmul_rn(0.2f, x);
    x = __fadd_rn(x, addition);
    x = x < -1.0f ? -1.0f : x;
    x = x > 1.0f ? 1.0f : x;

    // Uniformly accurate GELU expansion over the clamped interval.
    const float z = x * x;
    float p = 1.0f / 599040.0f;
    p = fmaf(p, z, -1.0f / 42240.0f);
    p = fmaf(p, z,  1.0f / 3456.0f);
    p = fmaf(p, z, -1.0f / 336.0f);
    p = fmaf(p, z,  1.0f / 40.0f);
    p = fmaf(p, z, -1.0f / 6.0f);
    p = fmaf(p, z,  1.0f);
    return fmaf(0.3989422804014327f * z, p, 0.5f * x);
}

__device__ __forceinline__ float4 activate4(
    float4 x, float4 b, float4 a
) {
    x.x = activate(x.x, b.x, a.x);
    x.y = activate(x.y, b.y, a.y);
    x.z = activate(x.z, b.z, a.z);
    x.w = activate(x.w, b.w, a.w);
    return x;
}

__device__ __forceinline__ void streaming_store(
    float4* address, float4 value
) {
    asm volatile(
        "st.global.cs.v4.f32 [%0], {%1, %2, %3, %4};"
        :
        : "l"(address),
          "f"(value.x), "f"(value.y), "f"(value.z), "f"(value.w)
        : "memory");
}

__global__ __launch_bounds__(256)
void epilogue64(
    float4* __restrict__ data,
    const float4* __restrict__ bias,
    const float4* __restrict__ addition,
    int64_t vectors
) {
    const int c = threadIdx.x & 15;
    const float4 b = bias[c];
    const float4 a = addition[c];

    // Each thread handles two independent, coalesced vectors.
    const int64_t i =
        static_cast<int64_t>(blockIdx.x) * 512 + threadIdx.x;
    const int64_t j = i + 256;

    if (j < vectors) {
        float4 v0 = data[i];
        float4 v1 = data[j];
        v0 = activate4(v0, b, a);
        v1 = activate4(v1, b, a);
        streaming_store(data + i, v0);
        streaming_store(data + j, v1);
    } else if (i < vectors) {
        streaming_store(data + i, activate4(data[i], b, a));
    }
}

template<bool CHANNELS_LAST>
__global__ void vector_epilogue(
    float4* __restrict__ data,
    const float* __restrict__ bias,
    const float* __restrict__ addition,
    int64_t vectors,
    int64_t spatial,
    int channels
) {
    const int64_t stride = static_cast<int64_t>(blockDim.x) * gridDim.x;
    for (int64_t i = static_cast<int64_t>(blockIdx.x) * blockDim.x
                         + threadIdx.x;
         i < vectors; i += stride) {
        float4 b, a;
        if (CHANNELS_LAST) {
            const int c = i % (channels / 4);
            b = reinterpret_cast<const float4*>(bias)[c];
            a = reinterpret_cast<const float4*>(addition)[c];
        } else {
            const int c = ((i * 4) / spatial) % channels;
            const float bv = bias[c];
            const float av = addition[c];
            b = make_float4(bv, bv, bv, bv);
            a = make_float4(av, av, av, av);
        }
        streaming_store(data + i, activate4(data[i], b, a));
    }
}

template<bool CHANNELS_LAST>
__global__ void scalar_epilogue(
    float* __restrict__ data,
    const float* __restrict__ bias,
    const float* __restrict__ addition,
    int64_t count,
    int64_t spatial,
    int channels
) {
    const int64_t stride = static_cast<int64_t>(blockDim.x) * gridDim.x;
    for (int64_t i = static_cast<int64_t>(blockIdx.x) * blockDim.x
                         + threadIdx.x;
         i < count; i += stride) {
        const int c = CHANNELS_LAST ? i % channels
                                   : (i / spatial) % channels;
        data[i] = activate(data[i], bias[c], addition[c]);
    }
}

torch::Tensor fused_epilogue_cuda(
    torch::Tensor x, torch::Tensor bias, torch::Tensor addition
) {
    TORCH_CHECK(x.is_cuda() && bias.is_cuda() && addition.is_cuda(),
                "Expected CUDA tensors");
    TORCH_CHECK(x.device() == bias.device() &&
                x.device() == addition.device(), "Device mismatch");
    TORCH_CHECK(x.scalar_type() == at::kFloat &&
                bias.scalar_type() == at::kFloat &&
                addition.scalar_type() == at::kFloat,
                "Expected float32 tensors");
    TORCH_CHECK(x.dim() == 5, "Expected a five-dimensional tensor");
    TORCH_CHECK(bias.is_contiguous() && addition.is_contiguous(),
                "Expected contiguous parameters");
    TORCH_CHECK(bias.numel() == x.size(1) &&
                addition.numel() == x.size(1),
                "Expected one parameter value per channel");

    const bool channels_last =
        x.is_contiguous(at::MemoryFormat::ChannelsLast3d);
    TORCH_CHECK(channels_last || x.is_contiguous(),
                "Unsupported tensor layout");

    const c10::cuda::CUDAGuard guard(x.device());
    const cudaStream_t stream =
        c10::cuda::getCurrentCUDAStream(x.get_device()).stream();

    const int64_t count = x.numel();
    if (count == 0) return x;

    const int channels = static_cast<int>(x.size(1));
    const int64_t spatial = x.size(2) * x.size(3) * x.size(4);
    const bool aligned =
        reinterpret_cast<uintptr_t>(x.data_ptr<float>()) % 16 == 0 &&
        reinterpret_cast<uintptr_t>(bias.data_ptr<float>()) % 16 == 0 &&
        reinterpret_cast<uintptr_t>(addition.data_ptr<float>()) % 16 == 0;
    const bool vectorized =
        aligned && (channels_last ? channels % 4 == 0 : spatial % 4 == 0);

    constexpr int threads = 256;

    if (vectorized && channels_last && channels == 64) {
        const int64_t vectors = count / 4;
        const int blocks = static_cast<int>((vectors + 511) / 512);
        epilogue64<<<blocks, threads, 0, stream>>>(
            reinterpret_cast<float4*>(x.data_ptr<float>()),
            reinterpret_cast<const float4*>(bias.data_ptr<float>()),
            reinterpret_cast<const float4*>(addition.data_ptr<float>()),
            vectors);
    } else {
        const int64_t work = vectorized ? count / 4 : count;
        const int blocks = static_cast<int>(
            std::min<int64_t>((work + threads - 1) / threads, 65535));

        if (vectorized && channels_last) {
            vector_epilogue<true><<<blocks, threads, 0, stream>>>(
                reinterpret_cast<float4*>(x.data_ptr<float>()),
                bias.data_ptr<float>(), addition.data_ptr<float>(),
                work, spatial, channels);
        } else if (vectorized) {
            vector_epilogue<false><<<blocks, threads, 0, stream>>>(
                reinterpret_cast<float4*>(x.data_ptr<float>()),
                bias.data_ptr<float>(), addition.data_ptr<float>(),
                work, spatial, channels);
        } else if (channels_last) {
            scalar_epilogue<true><<<blocks, threads, 0, stream>>>(
                x.data_ptr<float>(), bias.data_ptr<float>(),
                addition.data_ptr<float>(), count, spatial, channels);
        } else {
            scalar_epilogue<false><<<blocks, threads, 0, stream>>>(
                x.data_ptr<float>(), bias.data_ptr<float>(),
                addition.data_ptr<float>(), count, spatial, channels);
        }
    }

    C10_CUDA_KERNEL_LAUNCH_CHECK();
    return x;
}
"""

_fused_ops = load_inline(
    name="conv3d_streaming_fused_epilogue_v6",
    cpp_sources=_cpp_source,
    cuda_sources=_cuda_source,
    functions=["fused_epilogue_cuda"],
    extra_cflags=["-O3"],
    extra_cuda_cflags=["-O3"],
    verbose=False,
)


class ModelNew(nn.Module):
    def __init__(self, in_channels, out_channels, kernel_size, sum_tensor_shape):
        super().__init__()
        self.conv = nn.Conv3d(in_channels, out_channels, kernel_size)
        self.sum_tensor = nn.Parameter(torch.randn(sum_tensor_shape))

    def forward(self, x):
        use_custom = (
            x.is_cuda
            and x.dtype == torch.float32
            and self.conv.weight.dtype == torch.float32
            and self.conv.bias is not None
            and self.conv.bias.dtype == torch.float32
            and self.sum_tensor.dtype == torch.float32
            and tuple(self.sum_tensor.shape)
            == (self.conv.out_channels, 1, 1, 1)
            and not torch.is_autocast_enabled()
        )

        if use_custom:
            x = x.contiguous(memory_format=torch.channels_last_3d)
            weight = self.conv.weight.contiguous(
                memory_format=torch.channels_last_3d
            )
            x = F.conv3d(
                x,
                weight,
                None,
                self.conv.stride,
                self.conv.padding,
                self.conv.dilation,
                self.conv.groups,
            )
            return _fused_ops.fused_epilogue_cuda(
                x,
                self.conv.bias.contiguous(),
                self.sum_tensor.contiguous(),
            )

        x = self.conv(x)
        x = F.leaky_relu(x, negative_slope=0.2)
        x = torch.clamp(x + self.sum_tensor, min=-1.0, max=1.0)
        return F.gelu(x)
```