The error is raised by a wrong initialization of the nn.Conv2d and nn.ConvTranspose2d layers, e.g.:
nn.Conv2d(1, 19, 304, 304, kernel_size=3, stride=2, padding=1)

The expected arguments are given as:
Init signature:
nn.Conv2d(
    in_channels: int,
    out_channels: int,
    kernel_size: Union[int, Tuple[int, int]],
    stride: Union[int, Tuple[int, int]] = 1,
    padding: Union[int, Tuple[int, int]] = 0,
    dilation: Union[int, Tuple[int, int]] = 1,
    groups: int = 1,
    bias: bool = True,
    padding_mode: str = 'zeros',
)

so the 3rd values (304 in the posted line of code) would already specify the kernel size.