{"record":{"id":"a7a8d5195ae357ad","repo":"tensorflow/models","slug":"unsupported-pooling-strategy-pooling-r-expecte","errorCode":null,"errorMessage":"Unsupported pooling strategy: {pooling!r}. Expected one of {SUPPORTED_POOLING_STRATEGIES}.","messagePattern":"Unsupported pooling strategy: (.+?)\\. Expected one of (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/waste_identification_ml/Deploy/pet_grading_cloud_deployment/pet_grade_classifier.py","lineNumber":97,"sourceCode":"      num_classes: int,\n      pooling: str = POOLING_CLS,\n  ):\n    \"\"\"Initializes the Dinov3Classification model.\n\n    Args:\n        dinov3_repo_dir: Path to the cloned DINOv3 repository.\n        model_name: Name of the DINOv3 backbone variant to load.\n        num_classes: The number of output classes for the classification head.\n        pooling: The pooling strategy to use ('cls' or 'cls_mean_patch').\n          Defaults to 'cls'.\n\n    Raises:\n        ValueError: If an unsupported pooling strategy is provided.\n    \"\"\"\n    super().__init__()\n\n    if pooling not in SUPPORTED_POOLING_STRATEGIES:\n      raise ValueError(\n          f\"Unsupported pooling strategy: {pooling!r}. \"\n          f\"Expected one of {SUPPORTED_POOLING_STRATEGIES}.\"\n      )\n\n    self.pooling = pooling\n    self.backbone_model = _load_backbone(\n        dinov3_repo_dir=dinov3_repo_dir,\n        model_name=model_name,\n    )\n\n    backbone_hidden_size = self.backbone_model.norm.normalized_shape[0]\n    head_input_features = (\n        backbone_hidden_size\n        if pooling == POOLING_CLS\n        else 2 * backbone_hidden_size\n    )\n    self.head = nn.Linear(\n        in_features=head_input_features,","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/waste_identification_ml/Deploy/pet_grading_cloud_deployment/pet_grade_classifier.py#L79-L115","documentation":"Error \"Unsupported pooling strategy: {pooling!r}. Expected one of {SUPPORTED_POOLING_STRATEGIES}.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/waste_identification_ml/Deploy/pet_grading_cloud_deployment/pet_grade_classifier.py:97 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"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"}