{"record":{"id":"391121b9cb85f48c","repo":"tensorflow/models","slug":"padding-should-be-one-of-reflect-constant-or","errorCode":null,"errorMessage":"padding should be one of \"REFLECT\", \"CONSTANT\", or \"SYMMETRIC\".","messagePattern":"padding should be one of \"REFLECT\", \"CONSTANT\", or \"SYMMETRIC\"\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/ops/augment.py","lineNumber":120,"sourceCode":"  padding mode. For the even-sized filter, it pads one more value to the\n  right or the bottom side.\n\n  Args:\n    image: A 4-D `Tensor` of shape `[batch_size, height, width, channels]`.\n    filter_shape: A `tuple`/`list` of 2 integers, specifying the height and\n      width of the 2-D filter.\n    mode: A `string`, one of \"REFLECT\", \"CONSTANT\", or \"SYMMETRIC\". The type of\n      padding algorithm to use, which is compatible with `mode` argument in\n      `tf.pad`. For more details, please refer to\n      https://www.tensorflow.org/api_docs/python/tf/pad.\n    constant_values: A `scalar`, the pad value to use in \"CONSTANT\" padding\n      mode.\n\n  Returns:\n    A padded image.\n  \"\"\"\n  if mode.upper() not in {'REFLECT', 'CONSTANT', 'SYMMETRIC'}:\n    raise ValueError(\n        'padding should be one of \"REFLECT\", \"CONSTANT\", or \"SYMMETRIC\".'\n    )\n  constant_values = tf.convert_to_tensor(constant_values, image.dtype)\n  filter_height, filter_width = filter_shape\n  pad_top = (filter_height - 1) // 2\n  pad_bottom = filter_height - 1 - pad_top\n  pad_left = (filter_width - 1) // 2\n  pad_right = filter_width - 1 - pad_left\n  paddings = [[0, 0], [pad_top, pad_bottom], [pad_left, pad_right], [0, 0]]\n  return tf.pad(image, paddings, mode=mode, constant_values=constant_values)\n\n\ndef _get_gaussian_kernel(sigma, filter_shape):\n  \"\"\"Computes 1D Gaussian kernel.\"\"\"\n  sigma = tf.convert_to_tensor(sigma)\n  x = tf.range(-filter_shape // 2 + 1, filter_shape // 2 + 1)\n  x = tf.cast(x**2, sigma.dtype)\n  x = tf.nn.softmax(-x / (2.0 * (sigma**2)))","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/ops/augment.py#L102-L138","documentation":"Error \"padding should be one of \"REFLECT\", \"CONSTANT\", or \"SYMMETRIC\".\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/ops/augment.py:120 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set padding to one of 'REFLECT', 'CONSTANT', or 'SYMMETRIC'.","Check the padding argument for typos (case-sensitive)."],"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"}