title: How to get data from Tensor object in c++
body: <p>I am running a Tensorflow model return a 3D array as output, and I couldn't get that array of data from the tensor. </p>
  
  <p>I did print the shape of the output of the model without any problem.</p>
  
  <pre><code>std::vector&lt;tf::Tensor&gt;        outputs;
   auto start_inference = std::chrono::high_resolution_clock::now();
   _status = _session-&gt;Run({inputs}, {"k2tfout_0", "k2tfout_1"}, {}, &amp;outputs);
  if (!_status.ok())
   {
     std::cerr &lt;&lt; _status.ToString() &lt;&lt; std::endl;
     return 0;
   }
  unsigned int output_img_n0 = outputs[0].shape().dim_size(0);
  unsigned int output_img_h0 = outputs[0].shape().dim_size(1);
  unsigned int output_img_w0 = outputs[0].shape().dim_size(2);
  unsigned int output_img_c0 = outputs[0].shape().dim_size(3);
  </code></pre>
  
  <p>That code worked without any error and showed the shape of the array. But still, I couldn't get the data from the outputs Tensor object.</p>
  
  <p>The only function is worked is </p>
  
  <pre><code>float_t *plant_pointer = outputs[1].flat&lt;float_t&gt;().data();
  </code></pre>
  
  <p>But it destroy the array shape.<br/><br/>
  EDIT:<br/>
  The output shape of the tensor is [num,high,width,channel] === [1,480,600,3]. So, the output is an image of semantic segmentation image of the model. I just want the image part without the first dim which always be 1.</p>