```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 pooled_transpose_cuda(
    torch::Tensor x,
    torch::Tensor weight,
    torch::Tensor conv_bias,
    torch::Tensor bias);
"""

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

constexpr int THREADS = 256;
constexpr int CHUNK = 4096;

__device__ __forceinline__ float warp_sum(float value) {
    for (int offset = 16; offset > 0; offset >>= 1)
        value += __shfl_down_sync(0xffffffff, value, offset);
    return value;
}

__device__ __forceinline__ float block_sum(float value) {
    __shared__ float sums[32];
    const int lane = threadIdx.x & 31;
    const int warp = threadIdx.x >> 5;

    value = warp_sum(value);
    if (lane == 0)
        sums[warp] = value;
    __syncthreads();

    value = (threadIdx.x < blockDim.x / 32) ? sums[lane] : 0.0f;
    if (warp == 0)
        value = warp_sum(value);
    return value;
}

__device__ __forceinline__ float block_max(float value) {
    __shared__ float maxima[32];
    const int lane = threadIdx.x & 31;
    const int warp = threadIdx.x >> 5;

    for (int offset = 16; offset > 0; offset >>= 1)
        value = fmaxf(value, __shfl_down_sync(0xffffffff, value, offset));

    if (lane == 0)
        maxima[warp] = value;
    __syncthreads();

    value = (threadIdx.x < blockDim.x / 32)
        ? maxima[lane] : -CUDART_INF_F;

    if (warp == 0) {
        for (int offset = 16; offset > 0; offset >>= 1)
            value = fmaxf(
                value, __shfl_down_sync(0xffffffff, value, offset));
    }
    return value;
}

__global__ void spatial_partial_kernel(
    const float* __restrict__ x,
    float* __restrict__ partial,
    int64_t spatial,
    int chunks)
{
    const int chunk = blockIdx.x;
    const int nc = blockIdx.y;
    const int64_t start = int64_t(chunk) * CHUNK;
    const int64_t remaining = spatial - start;
    const int count = remaining < CHUNK ? int(remaining) : CHUNK;
    const float* source = x + int64_t(nc) * spatial + start;

    float sum = 0.0f;

    if ((spatial & 3) == 0) {
        const float4* source4 = reinterpret_cast<const float4*>(source);
        for (int i = threadIdx.x; i < count / 4; i += blockDim.x) {
            float4 v = source4[i];
            sum += (v.x + v.y) + (v.z + v.w);
        }
    } else {
        for (int i = threadIdx.x; i < count; i += blockDim.x)
            sum += source[i];
    }

    sum = block_sum(sum);
    if (threadIdx.x == 0)
        partial[int64_t(nc) * chunks + chunk] = sum;
}

__global__ void spatial_finish_kernel(
    const float* __restrict__ partial,
    float* __restrict__ scaled_sums,
    int chunks,
    float inverse_output_area)
{
    const int nc = blockIdx.x;
    float sum = 0.0f;

    for (int i = threadIdx.x; i < chunks; i += blockDim.x)
        sum += partial[int64_t(nc) * chunks + i];

    sum = block_sum(sum);
    if (threadIdx.x == 0)
        scaled_sums[nc] = sum * inverse_output_area;
}

__global__ void pooled_convolution_kernel(
    const float* __restrict__ scaled_sums,
    const float* __restrict__ weight,
    const float* __restrict__ conv_bias,
    const float* __restrict__ bias,
    float* __restrict__ pooled,
    int in_channels,
    int out_channels,
    int kernel_area)
{
    const int oc = blockIdx.x;
    const int batch = blockIdx.y;
    float value = 0.0f;

    for (int ic = threadIdx.x; ic < in_channels; ic += blockDim.x) {
        const float* w =
            weight + (int64_t(ic) * out_channels + oc) * kernel_area;
        float weight_sum = 0.0f;

        for (int k = 0; k < kernel_area; ++k)
            weight_sum += w[k];

        value = fmaf(
            scaled_sums[int64_t(batch) * in_channels + ic],
            weight_sum,
            value);
    }

    value = block_sum(value);
    if (threadIdx.x == 0) {
        pooled[int64_t(batch) * out_channels + oc] =
            (value + conv_bias[oc]) + bias[oc];
    }
}

__global__ void logsumexp_kernel(
    const float* __restrict__ pooled,
    float* __restrict__ output,
    int out_channels)
{
    __shared__ float maximum;
    const float* row = pooled + int64_t(blockIdx.x) * out_channels;

    float local_max = -CUDART_INF_F;
    for (int c = threadIdx.x; c < out_channels; c += blockDim.x)
        local_max = fmaxf(local_max, row[c]);

    local_max = block_max(local_max);
    if (threadIdx.x == 0)
        maximum = local_max;
    __syncthreads();

    float sum = 0.0f;
    for (int c = threadIdx.x; c < out_channels; c += blockDim.x)
        sum += expf(row[c] - maximum);

    sum = block_sum(sum);
    if (threadIdx.x == 0) {
        output[blockIdx.x] = isinf(maximum)
            ? maximum * 10.0f
            : (maximum + logf(sum)) * 10.0f;
    }
}

torch::Tensor pooled_transpose_cuda(
    torch::Tensor x,
    torch::Tensor weight,
    torch::Tensor conv_bias,
    torch::Tensor bias)
{
    const c10::cuda::CUDAGuard guard(x.device());

    const int batch = x.size(0);
    const int in_channels = x.size(1);
    const int out_channels = weight.size(1);
    const int64_t spatial = x.size(2) * x.size(3);
    const int kernel_area = weight.size(2) * weight.size(3);
    const int64_t output_area =
        (x.size(2) + weight.size(2) - 1) *
        (x.size(3) + weight.size(3) - 1);
    const int chunks = (spatial + CHUNK - 1) / CHUNK;

    auto partial = torch::empty(
        {int64_t(batch) * in_channels, chunks}, x.options());
    auto scaled_sums = torch::empty({batch, in_channels}, x.options());
    auto pooled = torch::empty({batch, out_channels}, x.options());
    auto output = torch::empty({batch, 1}, x.options());

    if (batch == 0)
        return output;

    cudaStream_t stream = at::cuda::getCurrentCUDAStream();

    spatial_partial_kernel<<<
        dim3(chunks, batch * in_channels), THREADS, 0, stream>>>(
        x.data_ptr<float>(),
        partial.data_ptr<float>(),
        spatial,
        chunks);
    C10_CUDA_KERNEL_LAUNCH_CHECK();

    spatial_finish_kernel<<<
        batch * in_channels, THREADS, 0, stream>>>(
        partial.data_ptr<float>(),
        scaled_sums.data_ptr<float>(),
        chunks,
        1.0f / float(output_area));
    C10_CUDA_KERNEL_LAUNCH_CHECK();

    pooled_convolution_kernel<<<
        dim3(out_channels, batch), 128, 0, stream>>>(
        scaled_sums.data_ptr<float>(),
        weight.data_ptr<float>(),
        conv_bias.data_ptr<float>(),
        bias.data_ptr<float>(),
        pooled.data_ptr<float>(),
        in_channels,
        out_channels,
        kernel_area);
    C10_CUDA_KERNEL_LAUNCH_CHECK();

    logsumexp_kernel<<<batch, THREADS, 0, stream>>>(
        pooled.data_ptr<float>(),
        output.data_ptr<float>(),
        out_channels);
    C10_CUDA_KERNEL_LAUNCH_CHECK();

    return output;
}
"""

_ops = load_inline(
    name="pooled_transpose_lse_cuda_v1",
    cpp_sources=_cpp_source,
    cuda_sources=_cuda_source,
    functions=["pooled_transpose_cuda"],
    extra_cflags=["-O3"],
    extra_cuda_cflags=["-O3"],
    verbose=False,
)


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

    def forward(self, x):
        conv = self.conv_transpose
        use_custom = (
            x.is_cuda
            and x.dtype == torch.float32
            and conv.weight.dtype == torch.float32
            and self.bias.dtype == torch.float32
            and x.ndim == 4
            and x.shape[1] == conv.in_channels
            and x.shape[2] > 0
            and x.shape[3] > 0
            and x.shape[0] * x.shape[1] <= 65535
            and tuple(self.bias.shape) == (conv.out_channels, 1, 1)
            and not torch.is_autocast_enabled()
            and not (
                torch.is_grad_enabled()
                and (
                    x.requires_grad
                    or conv.weight.requires_grad
                    or conv.bias.requires_grad
                    or self.bias.requires_grad
                )
            )
        )

        if use_custom:
            # With stride 1 and no padding, every input value contributes
            # every kernel coefficient to the full output's spatial sum.
            return _ops.pooled_transpose_cuda(
                x.contiguous(),
                conv.weight.contiguous(),
                conv.bias.contiguous(),
                self.bias.contiguous(),
            )

        x = conv(x)
        x = x.mean(dim=(2, 3), keepdim=True)
        x = x + self.bias
        x = torch.logsumexp(x, dim=1, keepdim=True)
        return x.sum(dim=(2, 3)) * 10.0
```