import tensorflow as tf
def add(a, b):
return a + b
list = list()
list.append(tf.ones([1, 2]))
list.append(tf.ones([2, 2]))
for element in list:
c = add(element, element)
While we could employ a similar fix for #89, I don't think it's ideal. First, a list is not a dataset. Second, I am seeing examples where @tf.function is used on functions that take lists of tensors as arguments, which makes sense because of the trace type:
Related to https://github.com/wala/ML/issues/89.
We actually mention this problem in #89:
Gets us:
While we could employ a similar fix for #89, I don't think it's ideal. First, a list is not a dataset. Second, I am seeing examples where
@tf.function
is used on functions that take lists of tensors as arguments, which makes sense because of the trace type:https://github.com/aymericdamien/TensorFlow-Examples/blob/6dcbe14649163814e72a22a999f20c5e247ce988/tensorflow_v2/notebooks/6_Hardware/multigpu_training.ipynb#L204-L218