Copy the placeholder this way:
input_placeholder = tf.placeholder(tf.int32,
[batch_size, sequence_len],
name="input")
copy_input = tf.Variable(initial_value=input_placeholder,
trainable=False)
Then this sentence reports an error:
sess.run(tf.global_variables_initializer())
Solution:
copy the placeholder in this way:
copy_input = tf.get_variable(
initializer=tf.constant(0, shape=[batch_size, sequence_len]),
name="copy_placeholder",
dtype=tf.int32, trainable=False)
copy_input.assign(input_placeholder)
Read More:
- Error in Tensorflow using variables: List of Tensors when single Tensor expected
- [Solved] TensorFlow Error: ‘Tensor‘ object does not support item assignment
- Tensorflow C++:You must define TF_LIB_GTL_ALIGNED_CHAR_ARRAY for your compiler
- [Solved] Tensorflow Error: Failed to load the native TensorFlow runtime.
- [Solved] Tensorflow-gpu 2.0.0 Run Error: ModuleNotFoundError: No module named ‘tensorflow_core.estimator‘
- Tensorflow error: attributeerror: module ‘tensorflow_ API. V1. Train ‘has no attribute’ summarywriter ‘
- TensorFlow error: AttributeError: module ‘tensorflow_core._api.v2.train’ has no attribute ‘Optimizer‘
- [Solved] MindSpore Error: For ‘MirrorPad‘, paddings must be a Tensor with *
- [How to Fix] Spring boot startup error: could not resolve placeholder
- [Solved] Tensorflow-gpu Error: self._traceback = tf_stack.extract_stack()
- Keras Concatenate error: Layer concatenate_1 was called with an input that isn’t a symbolic tensor…
- Tensorflow Error: Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR
- [Solved] pytorch CrossEntropyLoss Error: RuntimeError: 1D target tensor expected, multi-target not supported
- [Solved] Could not resolve placeholder ‘XXX‘ in value “${XXX}“
- Proguard Packaging Error: You have to specify ‘-keep‘ options if you want to write out kept elements with ‘-print
- Tensorflow error: InvalidArgumentError: indices[data_index] = data_value is not in [0, max_embedding_size)
- Git Error: please tell me who you are [How to Solve]
- Installation and error report of tensorflow
- [Solved] Tensorflow2.0 Error: Function call stack:distributed_function
- TensorFlow tf.keras.losses .MeanSquaredError