{"record":{"id":"9f88775e4a03e25c","repo":"tensorflow/models","slug":"the-argument-kernel-size-cannot-contain-0-s-re","errorCode":null,"errorMessage":"The argument `kernel_size` cannot contain 0(s). Received: %s","messagePattern":"The argument `kernel_size` cannot contain 0\\(s\\)\\. Received: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/modeling/layers/nn_layers.py","lineNumber":890,"sourceCode":"    if use_buffered_input:\n      padding[time_axis] = [0, 0]\n    else:\n      padding[time_axis] = [padding[time_axis][0] + padding[time_axis][1], 0]\n    return padding\n\n  def _causal_validate_init(self):\n    \"\"\"Validates the Conv layer initial configuration.\"\"\"\n    # Overriding this method is meant to circumvent unnecessary errors when\n    # using causal padding.\n    if (self.filters is not None\n        and self.filters % self.groups != 0):\n      raise ValueError(\n          'The number of filters must be evenly divisible by the number of '\n          'groups. Received: groups={}, filters={}'.format(\n              self.groups, self.filters))\n\n    if not all(self.kernel_size):\n      raise ValueError('The argument `kernel_size` cannot contain 0(s). '\n                       'Received: %s' % (self.kernel_size,))\n\n  def _buffered_spatial_output_shape(self, spatial_output_shape: List[int]):\n    \"\"\"Computes the spatial output shape from the input shape.\"\"\"\n    # When buffer padding, use 'valid' padding across time. The output shape\n    # across time should be the input shape minus any padding, assuming\n    # the stride across time is 1.\n    if self._use_buffered_input and spatial_output_shape[0] is not None:\n      padding = self._compute_buffered_causal_padding(\n          tf.zeros([1] + spatial_output_shape + [1]), use_buffered_input=False)\n      spatial_output_shape[0] -= sum(padding[1])\n    return spatial_output_shape\n\n\n@tf_keras.utils.register_keras_serializable(package='Vision')\nclass Conv2D(tf_keras.layers.Conv2D, CausalConvMixin):\n  \"\"\"Conv2D layer supporting CausalConv.\n","sourceCodeStart":872,"sourceCodeEnd":908,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/modeling/layers/nn_layers.py#L872-L908","documentation":"Error \"The argument `kernel_size` cannot contain 0(s). Received: %s\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/modeling/layers/nn_layers.py:890 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set kernel_size to positive integers only; remove any 0 entries.","Check the kernel_size config value for a stray 0."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}