tf.required_space_to_batch_paddings
Stay organized with collections
Save and categorize content based on your preferences.
Calculate padding required to make block_shape divide input_shape.
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.
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.
|
Returns |
(paddings, crops), where:
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_shapei % block_shape[i] == 0
crops[i, 0] = 0
crops[i, 1] = paddings[i, 1] - base_paddings[i, 1]
|
Raises: ValueError if called with incompatible shapes.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.required_space_to_batch_paddings\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 1 version](/versions/r1.15/api_docs/python/tf/required_space_to_batch_paddings) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.0.0/tensorflow/python/ops/array_ops.py#L3137-L3213) |\n\nCalculate padding required to make block_shape divide input_shape.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.required_space_to_batch_paddings`](/api_docs/python/tf/required_space_to_batch_paddings)\n\n\u003cbr /\u003e\n\n tf.required_space_to_batch_paddings(\n input_shape, block_shape, base_paddings=None, name=None\n )\n\nThis function can be used to calculate a suitable paddings argument for use\nwith space_to_batch_nd and batch_to_space_nd.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `input_shape` | int32 Tensor of shape \\[N\\]. |\n| `block_shape` | int32 Tensor of shape \\[N\\]. |\n| `base_paddings` | Optional int32 Tensor of shape \\[N, 2\\]. Specifies the minimum amount of padding to use. All elements must be \\\u003e= 0. If not specified, defaults to 0. |\n| `name` | string. Optional name prefix. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| (paddings, crops), where: \u003cbr /\u003e `paddings` and `crops` are int32 Tensors of rank 2 and shape \\[N, 2\\] ||\n| `satisfying` | paddings\\[i, 0\\] = base_paddings\\[i, 0\\]. 0 \\\u003c= paddings\\[i, 1\\] - base_paddings\\[i, 1\\] \\\u003c block_shape[i](/versions/r2.0/api_docs/python/tf/input_shape%5Bi%5D%20+%20paddings%5Bi,%200%5D%20+%20paddings%5Bi,%201%5D) % block_shape\\[i\\] == 0 \u003cbr /\u003e crops\\[i, 0\\] = 0 crops\\[i, 1\\] = paddings\\[i, 1\\] - base_paddings\\[i, 1\\] |\n\n\u003cbr /\u003e\n\nRaises: ValueError if called with incompatible shapes."]]