0

This is not a duplicate as I tried everything suggested on internet including tf.disable_v2_behavior() and tf.compat.v1.placeholder() which did not help me. Most people also suggested downgrading tensorflow to 1.4.However, I would like to know if this can still be solved using tensorflow 2.2.

I am creating a dataset using GAN and I have a code chunk as below. The problem is I have Tensorflow 2.2 and I get the error: module 'tensorflow' has no attribute 'placeholder'

d = 5

lr_rate = 1e-4

args = [rand_dim, nb_steps, batch_size, k_d, k_g, critic_pre_train_steps, log_interval, learning_rate, base_n_count, data_dir, generator_model_path, discriminator_model_path, loss_pickle_path, show ]

adversarial_training_WGAN(arguments, train_no_label, data_cols=data_cols ) # WGAN adversarial_training_WGAN(arguments, train, data_cols=data_cols, label_cols=label_cols ) # WCGAN

I keep getting the below error. Any help is greatly appreciated.

enter image description here

Malathy
  • 63
  • 7
  • This question might help? https://stackoverflow.com/questions/37383812/tensorflow-module-object-has-no-attribute-placeholder – BoomBoxBoy Feb 10 '21 at 02:37
  • 1
    @BrendanA Tried everything on this and it did not help! – Malathy Feb 10 '21 at 15:08
  • `import tensorflow.compat.v1 as tf tf.disable_v2_behavior() x = tf.placeholder(shape=[None, 2], dtype=tf.float32)` this worked for me. Thanks! –  Feb 24 '21 at 11:37

0 Answers0