// call enableRecordFunction() in the thread before running a model
   }
void onFunctionEnter(const RecordFunction& fn) {
       std::cerr << "Before function " << fn.name()
                 << " with " << fn.inputs().size() << " inputs" << std::endl;
   }
void onFunctionExit(const RecordFunction& fn) {
       std::cerr << "After function " << fn.name();
   }
API usage logging
When running in a broader ecosystem, for example in managed job
scheduler, it's often useful to track which binaries invoke particular
PyTorch APIs. There exists simple instrumentation injected at several
important API points that triggers a given callback. Because usually
PyTorch is invoked in one-off python scripts, the callback fires only
once for a given process for each of the APIs.
"c10::SetAPIUsageHandler" can be used to register API usage
instrumentation handler. Passed argument is going to be an "api key"
identifying used point, for example "python.import" for PyTorch