cansudemirkiran / CS591_TimeGAN

CS591 Deep Learning Course
0 stars 0 forks source link

NotImplementedError: Cannot convert a symbolic Tensor (sub:0) to a numpy array. #2

Open sujanme25 opened 4 years ago

sujanme25 commented 4 years ago

NotImplementedError Traceback (most recent call last)

in 5 6 # Synthetic Data Generation ----> 7 dataX_hat, loss_list = timegan(dataX, parameters) # Returns to synthetic dataset and stored loss values 8 losses.append(loss_list) 9 print('Finish Synthetic Data Generation') D:\Juypter_Sujan\CS591_TimeGAN\tgan.py in timegan(data, params) 184 # LOSSES 185 --> 186 D_loss, G_loss, S_loss, E_loss, E_loss_only, G_loss_adv_sup, G_loss_V = get_losses(Y_real, Y_fake, Y_fake_sup, H, H_sup, X_tilde_fake_sup, X, X_tilde) 187 188 D:\Juypter_Sujan\CS591_TimeGAN\tgan.py in get_losses(Y_real, Y_fake, Y_fake_sup, H, H_sup, X_tilde_fake_sup, X, X_tilde) 115 G_loss_adv = tf.losses.sigmoid_cross_entropy(tf.ones_like(Y_fake), Y_fake) 116 #generator mean and variance difference L1 loss --> 117 G_loss_V1 = tf.reduce_mean(np.abs(tf.sqrt(tf.nn.moments(X_tilde_fake_sup,[0])[1] + 1e-6) - tf.sqrt(tf.nn.moments(X,[0])[1] + 1e-6))) 118 G_loss_V2 = tf.reduce_mean(np.abs((tf.nn.moments(X_tilde_fake_sup,[0])[0]) - (tf.nn.moments(X,[0])[0]))) 119 G_loss_V = G_loss_V1 + G_loss_V2 D:\Anaconda\lib\site-packages\tensorflow_core\python\framework\ops.py in __array__(self) 734 def __array__(self): 735 raise NotImplementedError("Cannot convert a symbolic Tensor ({}) to a numpy" --> 736 " array.".format(self.name)) 737 738 def __len__(self): NotImplementedError: Cannot convert a symbolic Tensor (sub:0) to a numpy array.
cansudemirkiran commented 4 years ago

Sorry for the late reply. Have you installed the right version of tensor flow? And as a solution, I'd replace np.abs with tf.abs.