Spec-Zone.ru › TensorFlow

tf.get_current_name_scope

Возвращает текущий полный имя пространства, заданный tf.name_scope(...).

tf.get_current_name_scope() -> str

Например,

with tf.name_scope("outer"):
  tf.get_current_name_scope()  # "outer"

  with tf.name_scope("inner"):
    tf.get_current_name_scope()  # "outer/inner"

Другими словами, tf.get_current_name_scope() возвращает префикс имени операции, который будет добавлен в начало, если операция создается в данном месте.

Обратите внимание, что @tf.function сбрасывает стек пространства имен, как показано ниже.

with tf.name_scope("outer"):

  @tf.function
  def foo(x):
    with tf.name_scope("inner"):
      return tf.add(x * x)  # Op name is "inner/Add", not "outer/inner/Add"

© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/get_current_name_scope

Spec-Zone.ru

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