Skip to content

Instantly share code, notes, and snippets.

@kashefy
Last active February 3, 2016 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kashefy/1120e33ff8067b268dca to your computer and use it in GitHub Desktop.
Save kashefy/1120e33ff8067b268dca to your computer and use it in GitHub Desktop.
template <typename Dtype>
void printMat(const Dtype* data, int rows, int cols) {
int j = 0;
std::cout<<"np.array([";
for (int r=0; r<rows; r++) {
std::cout<<"[";
for (int c=0; c<cols; c++) {
std::cout<<data[j++];
if (c<cols-1) std::cout<<",";
}
std::cout<<"]";
if (r<rows-1) std::cout<<",";
}
std::cout<<"])";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment