Spec-Zone.ru › TensorFlow 2.4

tf.compat.v1.layers.experimental.set_keras_style

Использование управления переменными в стиле Keras.

tf.compat.v1.layers.experimental.set_keras_style()

Все tf.layers и tf RNN cells, созданные после включения стиля Keras, используют управление переменными в стиле Keras. Создание таких слоёв с аргументом scope= запрещено, а reuse=True запрещено.

Цель этой функции — позволить пользователям существующих слоёв постепенно переходить к API слоёв Keras без нарушения существующей функциональности.

Для получения более подробной информации см. документацию по keras_style_scope.

Обратите внимание, что после установки стиля Keras он устанавливается глобально для всей программы и не может быть снят.

Пример:

set_keras_style()

model_1 = RNNModel(name="model_1")
model_2 = RNNModel(name="model_2")

# model_1 and model_2 are guaranteed to create their own variables.
output_1, next_state_1 = model_1(input, state)
output_2, next_state_2 = model_2(input, state)

assert len(model_1.weights) > 0
assert len(model_2.weights) > 0
assert(model_1.weights != model_2.weights)

© 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/compat/v1/layers/experimental/set_keras_style

Spec-Zone.ru

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