Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.