leleamol commented on issue #15157: How to print data of NDArray in c++?
URL: 
https://github.com/apache/incubator-mxnet/issues/15157#issuecomment-499195722
 
 
   @moneypi 
    You can use the overloaded operator "<<" of mxnet::cpp::NDArray object as 
follows:
   
   `
   NDArray image_data = NDArray(input_shape, global_ctx, false);
     image_data.SyncCopyFromCPU(array.data(), input_shape.Size());
   std::cout << image_data;
   `
   
   You can refer to implementation of "<<" in ndarray.hpp here 
   
https://github.com/apache/incubator-mxnet/blob/c474f5f88ab39c39a64976adc59ef4cfe7a6be79/cpp-package/include/mxnet-cpp/ndarray.hpp#L433
   
   @mxnet-label-bot add [C++, Question]

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to