Spec-Zone.ru › TensorFlow

tf.compat.v1.autograph.to_code

Возвращает исходный код, сгенерированный AutoGraph, в виде строки.

tf.compat.v1.autograph.to_code(
    entity,
    recursive=True,
    arg_values=None,
    arg_types=None,
    indentation='  ',
    experimental_optional_features=None
)

Пример использования:

def f(x):
  if x < 0:
    x = -x
  return x
tf.autograph.to_code(f)
"...def tf__f(x):..."

См. также: tf.autograph.to_graph.

Примечание: Если функция декорирована с помощью tf.function, передайте исходную функцию Python, а не вызываемый объект, который создает `tf.function`:
@tf.function
def f(x):
  if x < 0:
    x = -x
  return x
tf.autograph.to_code(f.python_function)
"...def tf__f(x):..."
Аргументы
entity Вызываемый объект или класс Python.
recursive Следует ли рекурсивно преобразовывать любые функции, которые может вызывать преобразованная функция.
arg_values Устарел.
arg_types Устарел.
indentation Устарел.
experimental_optional_features None, кортеж или отдельное значение tf.autograph.experimental.Feature.
Возвращает
Преобразованный код в виде строки.

© 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/compat/v1/autograph/to_code

Spec-Zone.ru

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