-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
Hi,
I am wondering how you relate GCOV to TensorFlow or Pytorch, because I am also currently experimenting with code coverage for deep learning networks, but I can't get operator coverage (or line coverage) for a TensorFlow network model after calling it from a C++ program.
I did this by calling the encapsulated network model from a C++ program and then using GCOV on the C++ program, but that didn't associate it with the source code.
#include <iostream>
#include "Python.h"
int main() {
callModel();
return 0;
}
// call python program
void callModel(){
Py_Initialize();
const char *init_call = "import sys\n"
"import os\n"
"sys.path.append('/'.join(os.getcwd().split('/')[:-1]))\n";
PyRun_SimpleString(init_call);
PyObject* pModule = PyImport_ImportModule("torch_.lenet");
if (pModule != nullptr) {
PyObject* pFunc = PyObject_GetAttrString(pModule, "go");
PyObject_CallObject(pFunc, nullptr);
}
else{
printf("Fail");
}
Py_Finalize();
}g++ -fprofile-arcs -ftest-coverage main.cpp -o main
./main
gcov -n main.cpp
gcovr -v --html-details main.html
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels