tf.raw_ops.Tile
Создаёт тензор путём копирования заданного тензора.
tf.raw_ops.Tile(
input, multiples, name=None
)
Данная операция создаёт новый тензор путём копирования input multiples раз. Размерность i-го измерения выходного тензора содержит input.dims(i) * multiples[i] элементов, а значения input копируются multiples[i] раз по i-му измерению. Например, копирование [a b c d] по [2] даёт [a b c d a b c d].
a = tf.constant([[1,2,3],[4,5,6]], tf.int32)
b = tf.constant([1,2], tf.int32)
tf.tile(a, b)
<tf.Tensor: shape=(2, 6), dtype=int32, numpy=
array([[1, 2, 3, 1, 2, 3],
[4, 5, 6, 4, 5, 6]], dtype=int32)>
c = tf.constant([2,1], tf.int32)
tf.tile(a, c)
<tf.Tensor: shape=(4, 3), dtype=int32, numpy=
array([[1, 2, 3],
[4, 5, 6],
[1, 2, 3],
[4, 5, 6]], dtype=int32)>
d = tf.constant([2,2], tf.int32)
tf.tile(a, d)
<tf.Tensor: shape=(4, 6), dtype=int32, numpy=
array([[1, 2, 3, 1, 2, 3],
[4, 5, 6, 4, 5, 6],
[1, 2, 3, 1, 2, 3],
[4, 5, 6, 4, 5, 6]], dtype=int32)>
| Аргументы | |
|---|---|
input | A Tensor. 1-D или более высоких размерностей. |
multiples | A Tensor. Должен быть одним из следующих типов: int32, int64. 1-D. Длина должна совпадать с количеством измерений в input |
name | Имя операции (необязательно). |
| Возвращаемое значение | |
|---|---|
A Tensor. Имеет тот же тип, что и input. |
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/raw_ops/Tile