Spec-Zone.ru › TensorFlow 1.15

tf.keras.backend.reshape

Просмотреть исходный код на GitHub

Изменяет форму тензора на указанную.

Просмотр псевдонимов

Псевдонимы для миграции

См. Руководство по миграции для получения дополнительной информации.

tf.compat.v1.keras.backend.reshape, `tf.compat.v2.keras.backend.reshape`

tf.keras.backend.reshape(
    x, shape
)
Аргументы
x Тензор или переменная.
shape Кортеж целевой формы.
Возвращает
Тензор.

Пример:

a = tf.constant([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]])
a
<tf.Tensor: id=32, shape=(4, 3), dtype=int32, numpy=
array([[ 1,  2,  3],
       [ 4,  5,  6],
       [ 7,  8,  9],
       [10, 11, 12]], dtype=int32)>
tf.keras.backend.reshape(a, shape=(2, 6))
<tf.Tensor: id=35, shape=(2, 6), dtype=int32, numpy=
array([[ 1,  2,  3,  4,  5,  6],
       [ 7,  8,  9, 10, 11, 12]], 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/reshape

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API