Use dictionary in tf.function input_signature in Tensorflow 2.0

旧城冷巷雨未停 提交于 2020-05-27 05:15:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!