I am trying to save a tensor array that is necessarily computed into a function with the decorator @tf.function, this makes all the tensors inside the function into tensor graphs, and hence, non-iterable objects. For instance, in the following minimal code, I would like to know if it is possible to save the tensor into a file using code inside the function foo().
@tf.function
def foo(x):
# code for saving x
a=tf.constant([1,2,3])
foo(a)