By which command tf.placeholder is replaced in tensorflow 2.4?

1.1k views Asked by At

I am using tensorflow 2.4.1 and a code from tensorflow 1. Whenever I run the following command, I get an error

inputs = tf.placeholder(tf.int32, [None, None], name = 'input')

error

AttributeError                            Traceback (most recent call last)
<ipython-input-14-c2404ca8696c> in <module>()
----> 1 inputs = tf.placeholder(tf.int32, [None, None], name = 'input')

AttributeError: module 'tensorflow' has no attribute 'placeholder'
1

There are 1 answers

0
AudioBubble On

tf.keras.Input() is used in place of tf.placeholder() to instantiate a Keras tensor in Tensorflow version 2.x.

Please check this link for more details.