tf.raw_ops.MirrorPad
Stay organized with collections
Save and categorize content based on your preferences.
Pads a tensor with mirrored values.
tf.raw_ops.MirrorPad(
input, paddings, mode, name=None
)
This operation pads a input
with mirrored values according to the paddings
you specify. paddings
is an integer tensor with shape [n, 2]
, where n is
the rank of input
. For each dimension D of input
, paddings[D, 0]
indicates
how many values to add before the contents of input
in that dimension, and
paddings[D, 1]
indicates how many values to add after the contents of input
in that dimension. Both paddings[D, 0]
and paddings[D, 1]
must be no greater
than input.dim_size(D)
(or input.dim_size(D) - 1
) if copy_border
is true
(if false, respectively).
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, 2, 3], [4, 5, 6]].
# 'paddings' is [[1, 1]], [2, 2]].
# 'mode' is SYMMETRIC.
# rank of 't' is 2.
pad(t, paddings) ==> [[2, 1, 1, 2, 3, 3, 2]
[2, 1, 1, 2, 3, 3, 2]
[5, 4, 4, 5, 6, 6, 5]
[5, 4, 4, 5, 6, 6, 5]]
Args |
input
|
A Tensor . The input tensor to be padded.
|
paddings
|
A Tensor . Must be one of the following types: int32 , int64 .
A two-column matrix specifying the padding sizes. The number of
rows must be the same as the rank of input .
|
mode
|
A string from: "REFLECT", "SYMMETRIC" .
Either REFLECT or SYMMETRIC . In reflect mode the padded regions
do not include the borders, while in symmetric mode the padded regions
do include the borders. For example, if input is [1, 2, 3] and paddings
is [0, 2] , then the output is [1, 2, 3, 2, 1] in reflect mode, and
it is [1, 2, 3, 3, 2] in symmetric mode.
|
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.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf.raw_ops.MirrorPad\n\n\u003cbr /\u003e\n\nPads a tensor with mirrored values.\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.MirrorPad`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/MirrorPad)\n\n\u003cbr /\u003e\n\n tf.raw_ops.MirrorPad(\n input, paddings, mode, name=None\n )\n\nThis operation pads a `input` with mirrored values according to the `paddings`\nyou specify. `paddings` is an integer tensor with shape `[n, 2]`, where n is\nthe rank of `input`. For each dimension D of `input`, `paddings[D, 0]` indicates\nhow many values to add before the contents of `input` in that dimension, and\n`paddings[D, 1]` indicates how many values to add after the contents of `input`\nin that dimension. Both `paddings[D, 0]` and `paddings[D, 1]` must be no greater\nthan `input.dim_size(D)` (or `input.dim_size(D) - 1`) if `copy_border` is true\n(if false, respectively).\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, 2, 3], [4, 5, 6]].\n # 'paddings' is [[1, 1]], [2, 2]].\n # 'mode' is SYMMETRIC.\n # rank of 't' is 2.\n pad(t, paddings) ==\u003e [[2, 1, 1, 2, 3, 3, 2]\n [2, 1, 1, 2, 3, 3, 2]\n [5, 4, 4, 5, 6, 6, 5]\n [5, 4, 4, 5, 6, 6, 5]]\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `input` | A `Tensor`. The input tensor to be padded. |\n| `paddings` | A `Tensor`. Must be one of the following types: `int32`, `int64`. A two-column matrix specifying the padding sizes. The number of rows must be the same as the rank of `input`. |\n| `mode` | A `string` from: `\"REFLECT\", \"SYMMETRIC\"`. Either `REFLECT` or `SYMMETRIC`. In reflect mode the padded regions do not include the borders, while in symmetric mode the padded regions do include the borders. For example, if `input` is `[1, 2, 3]` and `paddings` is `[0, 2]`, then the output is `[1, 2, 3, 2, 1]` in reflect mode, and it is `[1, 2, 3, 3, 2]` in symmetric mode. |\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"]]