1

Tried to convert a TensorFlow programme from Python to C++ and found no such class Placeholder in the latest documentation 1.12 and 1.3. Dug up the internet and found out that since version 1.7, the Placeholder class disappeared from official documentation. Even though, that class is still in TensorFlow library v1.12 v1.13 and I'm using it.

Placeholder is found in version 1.0 (array_ops)
http://docs1.w3cub.com/tensorflow~cpp/class/tensorflow/ops/placeholder

Still there in version 1.4 (array_ops)
http://docs2.w3cub.com/tensorflow~cpp/class/tensorflow/ops/placeholder

Still there in version 1.6 (array_ops)
http://htmlpreview.github.io/?https://github.com/tensorflow/docs/blob/r1.6/site/en/api_docs/cc/namespace/tensorflow/ops.html

And no more in version 1.7+
http://htmlpreview.github.io/?https://github.com/tensorflow/docs/blob/r1.7/site/en/api_docs/cc/namespace/tensorflow/ops.html

Also not found in latest version 1.13
https://www.tensorflow.org/api_docs/cc/group/array-ops

But this Placeholder class is back in version 2.0
https://www.tensorflow.org/versions/r2.0/api_docs/cc/class/tensorflow/ops/placeholder

Here's how I'm using Placeholder in C++:

Scope R = Scope::NewRootScope();
Placeholder X = Placeholder(R,DT_FLOAT);

What should be the replacement for the Placeholder above, any other ways to specify X?

Dee
  • 7,455
  • 6
  • 36
  • 70

1 Answers1

0

The Placeholder class is not documented in TensorFlow 1.7 to 1.13, however, it is still in the TensorFlow lib and headers. And more importantly, it is exactly still there, in TensorFlow 2.0 as said in the question: https://www.tensorflow.org/versions/r2.0/api_docs/cc/class/tensorflow/ops/placeholder

There is another way to create feed tensors here: https://stackoverflow.com/a/51834143/5581893

But, to distinguish feed tensors (input, expected) from other tensor layers, using Placeholder class is the best option.

Dee
  • 7,455
  • 6
  • 36
  • 70