title: Tensorflow C++ Placeholder initialization
body: <p>I was trying to perform image captioning with tensorflow on cpp. I was following the direction on <a href="https://stackoverflow.com/questions/46098863/how-to-import-an-saved-tensorflow-model-train-using-tf-estimator-and-predict-on/46139198?noredirect=1#comment79297585_46139198">How to import an saved Tensorflow model train using tf.estimator and predict on input data</a> and tried</p>
  
  <pre><code>int main(int argc, char**) {
  ....
      auto x = tf::Tensor(tf::DT_UINT8, tf::TensorShape({height, width, channel}));
      auto matrix = x.matrix&lt;char&gt;();
  ....
  }
  </code></pre>
  
  <p>When I compile the program, the code </p>
  
  <pre><code>&gt; In file included from /usr/local/include/tensorflow/core/framework/tensor.h:26:0,
                   from /usr/local/include/tensorflow/core/public/session.h:23,
                   from /usr/local/include/tensorflow/cc/saved_model/loader.h:26,
                   from server.cpp:22:
  /usr/local/include/tensorflow/core/framework/types.h: In instantiation of ‘struct tensorflow::DataTypeToEnum&lt;char&gt;’:
  /usr/local/include/tensorflow/core/framework/tensor.h:530:46:   required from ‘typename tensorflow::TTypes&lt;T, NDIMS&gt;::Tensor tensorflow::Tensor::tensor() [with T = char; long unsigned int NDIMS = 2ul; typename tensorflow::TTypes&lt;T, NDIMS&gt;::Tensor = Eigen::TensorMap&lt;Eigen::Tensor&lt;char, 2, 1, long int&gt;, 16, Eigen::MakePointer&gt;]’
  /usr/local/include/tensorflow/core/framework/tensor.h:240:25:   required from ‘typename tensorflow::TTypes&lt;T&gt;::Matrix tensorflow::Tensor::matrix() [with T = char; typename tensorflow::TTypes&lt;T&gt;::Matrix = Eigen::TensorMap&lt;Eigen::Tensor&lt;char, 2, 1, long int&gt;, 16, Eigen::MakePointer&gt;]’
  server.cpp:121:34:   required from here
  /usr/local/include/tensorflow/core/framework/types.h:138:3: error: static assertion failed: Specified Data Type not supported
     static_assert(IsValidDataType&lt;T&gt;::value, "Specified Data Type not supported");In file included from /usr/local/include/tensorflow/core/public/session.h:23:0,
               from /usr/local/include/tensorflow/cc/saved_model/loader.h:26,
               from server.cpp:22:
  /usr/local/include/tensorflow/core/framework/tensor.h: In instantiation of ‘typename tensorflow::TTypes&lt;T, NDIMS&gt;::Tensor tensorflow::Tensor::tensor() [with T = char; long unsigned int NDIMS = 2ul; typename tensorflow::TTypes&lt;T, NDIMS&gt;::Tensor = Eigen::TensorMap&lt;Eigen::Tensor&lt;char, 2, 1, long int&gt;, 16, Eigen::MakePointer&gt;]’:
  /usr/local/include/tensorflow/core/framework/tensor.h:240:25:   required from ‘typename tensorflow::TTypes&lt;T&gt;::Matrix tensorflow::Tensor::matrix() [with T = char; typename tensorflow::TTypes&lt;T&gt;::Matrix = Eigen::TensorMap&lt;Eigen::Tensor&lt;char, 2, 1, long int&gt;, 16, Eigen::MakePointer&gt;]’
  server.cpp:121:34:   required from here
  /usr/local/include/tensorflow/core/framework/tensor.h:530:46: error: ‘v’ is not a member of ‘tensorflow::DataTypeToEnum&lt;char&gt;’
     CheckTypeAndIsAligned(DataTypeToEnum&lt;T&gt;::v());
  </code></pre>
  
  <p>Did anybody came across the same problem?</p>