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

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

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

__global__ void subtract_tanh_float4(
    float* __restrict__ x,
    const float* __restrict__ bias,
    int64_t count,
    int64_t spatial4,
    int64_t channels,
    int64_t batch_stride,
    int64_t channel_stride)
{
    float4* values = reinterpret_cast<float4*>(x);
    for (int64_t i = int64_t(blockIdx.x) * blockDim.x + threadIdx.x;
         i < count;
         i += int64_t(blockDim.x) * gridDim.x) {
        const int64_t nc = i / spatial4;
        const float b = bias[
            (nc / channels) * batch_stride +
            (nc % channels) * channel_stride];

        float4 v = values[i];
        v.x = tanhf(v.x - b);
        v.y = tanhf(v.y - b);
        v.z = tanhf(v.z - b);
        v.w = tanhf(v.w - b);
        values[i] = v;
    }
}

template <typename scalar_t>
__global__ void subtract_tanh_generic(
    scalar_t* __restrict__ x,
    const scalar_t* __restrict__ bias,
    int64_t count,
    int64_t channels,
    int64_t height,
    int64_t width,
    int64_t s0,
    int64_t s1,
    int64_t s2,
    int64_t s3)
{
    using acc_t = at::acc_type<scalar_t, true>;

    for (int64_t i = int64_t(blockIdx.x) * blockDim.x + threadIdx.x;
         i < count;
         i += int64_t(blockDim.x) * gridDim.x) {
        int64_t q = i;
        const int64_t w = q % width;
        q /= width;
        const int64_t h = q % height;
        q /= height;
        const int64_t c = q % channels;
        const int64_t n = q / channels;

        const acc_t v = static_cast<acc_t>(x[i]) -
            static_cast<acc_t>(bias[n*s0 + c*s1 + h*s2 + w*s3]);
        x[i] = static_cast<scalar_t>(tanh(v));
    }
}

torch::Tensor subtract_tanh_cuda(torch::Tensor x, torch::Tensor bias)
{
    TORCH_CHECK(x.is_cuda() && bias.is_cuda(), "Expected CUDA tensors");
    TORCH_CHECK(x.device() == bias.device(), "Devices must match");
    TORCH_CHECK(x.scalar_type() == bias.scalar_type(), "Dtypes must match");
    TORCH_CHECK(x.dim() == 4 && x.is_contiguous(),
                "Expected contiguous NCHW input");

    const c10::cuda::CUDAGuard guard(x.device());
    const auto expanded = bias.expand(x.sizes());
    const int64_t count = x.numel();
    if (count == 0)
        return x;

    const int64_t channels = x.size(1);
    const int64_t height = x.size(2);
    const int64_t width = x.size(3);
    const int64_t spatial = height * width;
    const auto stream = c10::cuda::getCurrentCUDAStream(x.get_device());
    constexpr int threads = 256;

    if (x.scalar_type() == at::kFloat &&
        spatial % 4 == 0 &&
        expanded.stride(2) == 0 &&
        expanded.stride(3) == 0 &&
        reinterpret_cast<uintptr_t>(x.data_ptr<float>()) % 16 == 0) {
        const int64_t vectors = count / 4;
        const int blocks = static_cast<int>(
            std::min<int64_t>((vectors + threads - 1) / threads, 65535));

        subtract_tanh_float4<<<blocks, threads, 0, stream.stream()>>>(
            x.data_ptr<float>(), bias.data_ptr<float>(),
            vectors, spatial / 4, channels,
            expanded.stride(0), expanded.stride(1));
    } else {
        const int blocks = static_cast<int>(
            std::min<int64_t>((count + threads - 1) / threads, 65535));

        AT_DISPATCH_FLOATING_TYPES_AND2(
            at::ScalarType::Half, at::ScalarType::BFloat16,
            x.scalar_type(), "subtract_tanh_cuda", [&] {
                subtract_tanh_generic<scalar_t>
                    <<<blocks, threads, 0, stream.stream()>>>(
                        x.data_ptr<scalar_t>(), bias.data_ptr<scalar_t>(),
                        count, channels, height, width,
                        expanded.stride(0), expanded.stride(1),
                        expanded.stride(2), expanded.stride(3));
            });
    }

    C10_CUDA_KERNEL_LAUNCH_CHECK();
    return x;
}
"""

_fused = load_inline(
    name="conv_transpose_subtract_tanh_fused",
    cpp_sources=_cpp_source,
    cuda_sources=_cuda_source,
    functions=["subtract_tanh_cuda"],
    extra_cflags=["-O3"],
    extra_cuda_cflags=["-O3"],
    verbose=False,
)


class _SubtractTanh(torch.autograd.Function):
    @staticmethod
    def forward(ctx, x, bias):
        ctx.bias_shape = bias.shape
        ctx.mark_dirty(x)
        _fused.subtract_tanh_cuda(x, bias)
        ctx.save_for_backward(x)
        return x

    @staticmethod
    def backward(ctx, grad_output):
        (output,) = ctx.saved_tensors
        grad = grad_output * (1 - output.square())
        grad_bias = (
            -grad.sum_to_size(ctx.bias_shape)
            if ctx.needs_input_grad[1]
            else None
        )
        return grad if ctx.needs_input_grad[0] else None, grad_bias


class ModelNew(nn.Module):
    def __init__(
        self,
        in_channels,
        out_channels,
        kernel_size,
        bias_shape,
        stride=2,
        padding=1,
        output_padding=1,
    ):
        super().__init__()
        self.conv_transpose = nn.ConvTranspose2d(
            in_channels,
            out_channels,
            kernel_size,
            stride=stride,
            padding=padding,
            output_padding=output_padding,
        )
        self.bias = nn.Parameter(torch.randn(bias_shape))

    def forward(self, x):
        x = self.conv_transpose(x)
        if not x.is_cuda or x.dtype != self.bias.dtype:
            return torch.tanh(x - self.bias)

        x = x.contiguous()
        if torch.is_grad_enabled() and (x.requires_grad or self.bias.requires_grad):
            return _SubtractTanh.apply(x, self.bias)
        return _fused.subtract_tanh_cuda(x, self.bias)
```