tf.raw_ops.PadV2
Stay organized with collections
Save and categorize content based on your preferences.
Pads a tensor.
tf.raw_ops.PadV2(
input, paddings, constant_values, name=None
)
This operation pads input
according to the paddings
and constant_values
you specify. paddings
is an integer tensor with shape [Dn, 2]
, where n is
the rank of input
. For each dimension D of input
, paddings[D, 0]
indicates
how many padding values to add before the contents of input
in that dimension,
and paddings[D, 1]
indicates how many padding values to add after the contents
of input
in that dimension. constant_values
is a scalar tensor of the same
type as input
that indicates the value to use for padding input
.
The padded size of each dimension D of the output is:
paddings(D, 0) + input.dim_size(D) + paddings(D, 1)
For example:
# 't' is [[1, 1], [2, 2]]
# 'paddings' is [[1, 1], [2, 2]]
# 'constant_values' is 0
# rank of 't' is 2
pad(t, paddings) ==> [[0, 0, 0, 0, 0, 0]
[0, 0, 1, 1, 0, 0]
[0, 0, 2, 2, 0, 0]
[0, 0, 0, 0, 0, 0]]
Args |
input
|
A Tensor .
|
paddings
|
A Tensor . Must be one of the following types: int32 , int64 .
|
constant_values
|
A Tensor . Must have the same type as input .
|
name
|
A name for the operation (optional).
|
Returns |
A Tensor . Has the same type as input .
|
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[],null,["# tf.raw_ops.PadV2\n\n\u003cbr /\u003e\n\nPads a tensor.\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.raw_ops.PadV2`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/PadV2)\n\n\u003cbr /\u003e\n\n tf.raw_ops.PadV2(\n input, paddings, constant_values, name=None\n )\n\nThis operation pads `input` according to the `paddings` and `constant_values`\nyou specify. `paddings` is an integer tensor with shape `[Dn, 2]`, where n is\nthe rank of `input`. For each dimension D of `input`, `paddings[D, 0]` indicates\nhow many padding values to add before the contents of `input` in that dimension,\nand `paddings[D, 1]` indicates how many padding values to add after the contents\nof `input` in that dimension. `constant_values` is a scalar tensor of the same\ntype as `input` that indicates the value to use for padding `input`.\n\nThe padded size of each dimension D of the output is:\n\n`paddings(D, 0) + input.dim_size(D) + paddings(D, 1)`\n\n#### For example:\n\n # 't' is [[1, 1], [2, 2]]\n # 'paddings' is [[1, 1], [2, 2]]\n # 'constant_values' is 0\n # rank of 't' is 2\n pad(t, paddings) ==\u003e [[0, 0, 0, 0, 0, 0]\n [0, 0, 1, 1, 0, 0]\n [0, 0, 2, 2, 0, 0]\n [0, 0, 0, 0, 0, 0]]\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------------|-------------------------------------------------------------------|\n| `input` | A `Tensor`. |\n| `paddings` | A `Tensor`. Must be one of the following types: `int32`, `int64`. |\n| `constant_values` | A `Tensor`. Must have the same type as `input`. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor`. Has the same type as `input`. ||\n\n\u003cbr /\u003e"]]