问题
I am using Tensorflow 2.0 and facing the following situation:
@tf.function
def my_fn(items):
.... #do stuff
return
If items is a dict of Tensors like for example:
item1 = tf.zeros([1, 1])
item2 = tf.zeros(1)
items = {"item1": item1, "item2": item2}
Is there a way of using input_signature argument of tf.function so I can force tf2 to avoid creating multiple graphs when item1 is for example tf.zeros([2,1])
?
来源:https://stackoverflow.com/questions/60827999/use-dictionary-in-tf-function-input-signature-in-tensorflow-2-0