I've looked all over but can't find anyone who's previous answers help.
I have a tensorflow model with an @tf.function in it that does the training (tf version 2.3.0). Within the train_step call, I need to pass the data from a tensor on to a numpy function that performs a cwt transform on it. There is (afaik) no tensorflow cwt, thus the need to pass this on to a numpy function. The issue I have is that within the @tf.function, the tensors are graphed, and thus one cannot directly call .numpy() to transform that tensor into a numpy array. Small code snippet shows the code, below.
My question is how can I transform my generated output data from my generator call into something I can pass on to this numpy function. Here's hoping there's a way to do this!
Thanks.
@tf.function
def train_step(self, true_data):
noise = tf.random.uniform(shape=[1, 100, 1], minval=0, maxval=1, dtype=tf.float32)
with tf.GradientTape() as gen_tape, tf.GradientTape() as disc_tape:
generated_data = self.generator(noise)
nump_data = generated_data.numpy()
<this line produces: AttributeError: 'Tensor' object has no attribute 'numpy'>