{"record":{"id":"a46b3e91da27125f","repo":"keras-team/keras","slug":"strides-1-not-supported-in-conjunction-with-d","errorCode":null,"errorMessage":"`strides > 1` not supported in conjunction with `dilation_rate > 1`. Received: strides={self.strides} and dilation_rate={self.dilation_rate}","messagePattern":"`strides > 1` not supported in conjunction with `dilation_rate > 1`\\. Received: strides=(.+?) and dilation_rate=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/convolutional/base_conv_transpose.py","lineNumber":159,"sourceCode":"        if not all(self.strides):\n            raise ValueError(\n                \"The argument `strides` cannot contains 0. Received \"\n                f\"strides={self.strides}.\"\n            )\n\n        if self.output_padding is not None:\n            for i, (op, s) in enumerate(zip(self.output_padding, self.strides)):\n                if op >= s:\n                    raise ValueError(\n                        \"`output_padding` must be strictly less than \"\n                        f\"`strides` for all dimensions. At dimension {i}, \"\n                        f\"`output_padding` is {op} but `strides` is {s}. \"\n                        f\"Received: output_padding={self.output_padding}, \"\n                        f\"strides={self.strides}\"\n                    )\n\n        if max(self.strides) > 1 and max(self.dilation_rate) > 1:\n            raise ValueError(\n                \"`strides > 1` not supported in conjunction with \"\n                f\"`dilation_rate > 1`. Received: strides={self.strides} and \"\n                f\"dilation_rate={self.dilation_rate}\"\n            )\n\n        if self.output_padding is not None:\n            for i, (op, s) in enumerate(zip(self.output_padding, self.strides)):\n                if op >= s:\n                    raise ValueError(\n                        \"Invalid `output_padding` argument. \"\n                        \"Each value in `output_padding` must be strictly \"\n                        \"less than the corresponding `strides` value.\\n\"\n                        f\"At index {i}, `output_padding` is {op} and `strides` \"\n                        f\"is {s}.\\n\"\n                        f\"Received: output_padding={self.output_padding}, \"\n                        f\"strides={self.strides}.\"\n                    )\n","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/convolutional/base_conv_transpose.py#L141-L177","documentation":"Keras transpose-convolution layers (Conv2DTranspose etc.) reject any configuration where both strides and dilation_rate exceed 1. The backend algorithms for transposed convolutions cannot combine strided upsampling with dilated kernels, so the constructor fails fast at layer creation.","triggerScenarios":"Constructing keras.layers.Conv2DTranspose (or Conv1DTranspose/Conv3DTranspose) with e.g. strides=2 and dilation_rate=2: max of any stride dim >1 AND max of any dilation dim >1 triggers it.","commonSituations":"Copying a regular Conv2D config into a Conv*DTranspose; attempting dilated upsampling architectures (generator networks) without knowing transposed conv limits.","solutions":["Set dilation_rate back to 1 and keep the stride, growing receptive field via kernel_size instead.","Replace the transpose conv with UpSampling2D followed by a dilated Conv2D, which supports the combination.","Assert the combo in your model factory so invalid configs fail at config time."],"exampleFix":"# before\nlayer = keras.layers.Conv2DTranspose(64, 3, strides=2, dilation_rate=2)\n\n# after\nlayer = keras.layers.Conv2DTranspose(64, 3, strides=2)\n# or: UpSampling2D(size=2) + Conv2D(64, 3, dilation_rate=2)","handlingStrategy":"validation","validationCode":"assert valid_transpose_cfg(strides, dilation_rate), 'strides>1 with dilation>1 unsupported'","typeGuard":"def valid_transpose_cfg(strides, dilation_rate) -> bool:\n    s = strides if isinstance(strides, (tuple, list)) else (strides,)\n    d = dilation_rate if isinstance(dilation_rate, (tuple, list)) else (dilation_rate,)\n    return not (max(s) > 1 and max(d) > 1)","tryCatchPattern":null,"preventionTips":["Validate stride/dilation combos at config time","Use UpSampling + dilated Conv for dilated upsampling"],"tags":["keras","convolution","transposed-conv","invalid-arguments"],"backgroundTag":"invalid-convolution-arguments","analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}