{"record":{"id":"6ad800c78e0679a6","repo":"tensorflow/models","slug":"translations-rank-must-be-statically-known-6ad800","errorCode":null,"errorMessage":"translations rank must be statically known","messagePattern":"translations rank must be statically known","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"official/vision/ops/augment.py","lineNumber":305,"sourceCode":"     [0 0 1]]\n\n  Args:\n    translations: The 2-element list representing [dx, dy], or a matrix of\n      2-element lists representing [dx dy] to translate for each image. The\n      shape must be static.\n\n  Returns:\n    The transformation matrix of shape (num_images, 8).\n\n  Raises:\n    `TypeError` if\n      - the shape of `translations` is not known or\n      - the shape of `translations` is not rank 1 or 2.\n\n  \"\"\"\n  translations = tf.convert_to_tensor(translations, dtype=tf.float32)\n  if translations.get_shape().ndims is None:\n    raise TypeError('translations rank must be statically known')\n  elif len(translations.get_shape()) == 1:\n    translations = translations[None]\n  elif len(translations.get_shape()) != 2:\n    raise TypeError('translations should have rank 1 or 2.')\n  num_translations = tf.shape(translations)[0]\n\n  return tf.concat(\n      values=[\n          tf.ones((num_translations, 1), tf.dtypes.float32),\n          tf.zeros((num_translations, 1), tf.dtypes.float32),\n          -translations[:, 0, None],\n          tf.zeros((num_translations, 1), tf.dtypes.float32),\n          tf.ones((num_translations, 1), tf.dtypes.float32),\n          -translations[:, 1, None],\n          tf.zeros((num_translations, 2), tf.dtypes.float32),\n      ],\n      axis=1,\n  )","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/ops/augment.py#L287-L323","documentation":"Error \"translations rank must be statically known\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/ops/augment.py:305 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide translations with a statically known rank (reshape with a fixed shape).","Avoid passing tensors with unknown rank; use tf.ensure_shape or a fixed-shape placeholder."],"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"}