tf.required_space_to_batch_paddings  |  TensorFlow v2.16.1 (original) (raw)

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.

View aliases

Compat aliases for migration

SeeMigration guide for more details.

tf.compat.v1.required_space_to_batch_paddings

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] == 0crops[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. Some content is licensed under the numpy license.

Last updated 2024-04-26 UTC.