{"record":{"id":"539a25aa425d0003","repo":"tensorflow/models","slug":"multigrid-has-to-match-number-of-block-repeats","errorCode":null,"errorMessage":"multigrid has to match number of block_repeats","messagePattern":"multigrid has to match number of block_repeats","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/modeling/backbones/resnet_deeplab.py","lineNumber":323,"sourceCode":"      inputs: A `tf.Tensor` of size `[batch, channels, height, width]`.\n      filters: An `int` off number of filters for the first convolution of the\n        layer.\n      strides: An `int` of stride to use for the first convolution of the layer.\n        If greater than 1, this layer will downsample the input.\n      dilation_rate: An `int` of diluted convolution rates.\n      block_fn: Either `nn_blocks.ResidualBlock` or `nn_blocks.BottleneckBlock`.\n      block_repeats: An `int` of number of blocks contained in the layer.\n      stochastic_depth_drop_rate: A `float` of drop rate of the current block\n        group.\n      multigrid: A list of `int` or None. If specified, dilation rates for each\n        block is scaled up by its corresponding factor in the multigrid.\n      name: A `str` name for the block.\n\n    Returns:\n      The output `tf.Tensor` of the block layer.\n    \"\"\"\n    if multigrid is not None and len(multigrid) != block_repeats:\n      raise ValueError('multigrid has to match number of block_repeats')\n\n    if multigrid is None:\n      multigrid = [1] * block_repeats\n\n    # TODO(arashwan): move striding at the of the block.\n    x = block_fn(\n        filters=filters,\n        strides=strides,\n        dilation_rate=dilation_rate * multigrid[0],\n        use_projection=True,\n        stochastic_depth_drop_rate=stochastic_depth_drop_rate,\n        se_ratio=self._se_ratio,\n        resnetd_shortcut=self._resnetd_shortcut,\n        kernel_initializer=self._kernel_initializer,\n        kernel_regularizer=self._kernel_regularizer,\n        bias_regularizer=self._bias_regularizer,\n        activation=self._activation,\n        use_sync_bn=self._use_sync_bn,","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/modeling/backbones/resnet_deeplab.py#L305-L341","documentation":"Error \"multigrid has to match number of block_repeats\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/modeling/backbones/resnet_deeplab.py:323 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set multigrid to a list with one dilation value per block repeat (length must equal block_repeats).","Set multigrid to None to disable multi-grid dilation."],"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"}