TensorFlow Graphs: An In - Depth Exploration
1. TF Functions and Concrete Functions
TF Functions are polymorphic, supporting inputs of different types and shapes. Consider the following tf_cube() function:
import tensorflow as tf
@tf.function
def tf_cube(x):
return x ** 3
Every time a TF Function is called with a new combination of input types or shapes (input signature), a new concrete function is generated. For example:
concrete_function = tf_cube.get_concrete_function(tf.constant(2.0))
print(concrete_function)
print(concrete_function(tf.constant(2.0)))
The tensors in the graphs generated by these functions are symbol
超级会员免费看
订阅专栏 解锁全文
61

被折叠的 条评论
为什么被折叠?



