tf.keras.backend.repeat
| Просмотреть исходный код на GitHub |
Повторяет 2D тензор.
tf.keras.backend.repeat(
x, n
)
Если x имеет форму (образцы, размер) и n является 2, то выход будет иметь форму (samples, 2, dim).
| Аргументы | |
|---|---|
x | Тензор или переменная. |
n | Целое число Python, количество повторений. |
| Возвращает | |
|---|---|
| Тензор. |
Пример:
b = tf.constant([[1, 2], [3, 4]])
b
<tf.Tensor: id=78, shape=(2, 2), dtype=int32, numpy=
array([[1, 2],
[3, 4]], dtype=int32)>
tf.keras.backend.repeat(b, n=2)
<tf.Tensor: id=82, shape=(2, 2, 2), dtype=int32, numpy=
array([[[1, 2],
[1, 2]],
[[3, 4],
[3, 4]]], dtype=int32)>
© 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/r1.15/api_docs/python/tf/keras/backend/repeat