# tf.required_space_to_batch_paddings

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.14.0/tensorflow/python/ops/array_ops.py#L3937-L4013) |

Calculate padding required to make block_shape divide input_shape.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.required_space_to_batch_paddings`](https://www.tensorflow.org/api_docs/python/tf/required_space_to_batch_paddings)

<br />

    tf.required_space_to_batch_paddings(
        input_shape, block_shape, base_paddings=None, name=None
    )

This function can be used to calculate a suitable paddings argument for use
with space_to_batch_nd and batch_to_space_nd.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `input_shape` | int32 Tensor of shape \[N\]. |
| `block_shape` | int32 Tensor of shape \[N\]. |
| `base_paddings` | Optional int32 Tensor of shape \[N, 2\]. Specifies the minimum amount of padding to use. All elements must be \>= 0. If not specified, defaults to 0. |
| `name` | string. Optional name prefix. |

<br />

<br />

| ## Returns ||
|---|---|
| (paddings, crops), where: <br /> `paddings` and `crops` are int32 Tensors of rank 2 and shape \[N, 2\] ||
| `satisfying` | paddings\[i, 0\] = base_paddings\[i, 0\]. 0 \<= paddings\[i, 1\] - base_paddings\[i, 1\] \< block_shape[i](https://www.tensorflow.org/versions/r2.14/api_docs/python/tf/input_shape%5Bi%5D%20+%20paddings%5Bi,%200%5D%20+%20paddings%5Bi,%201%5D) % block_shape\[i\] == 0 <br /> crops\[i, 0\] = 0 crops\[i, 1\] = paddings\[i, 1\] - base_paddings\[i, 1\] |

<br />

Raises: ValueError if called with incompatible shapes.