sdcb/PaddleSharp

Enable ONNX Runtime Profiling

Closed this issue · 2 comments

@sdcb is it easy to enable ONNX runtime profiling with your API here?

Like this: https://onnxruntime.ai/docs/performance/tune-performance/profiling-tools.html#in-code-performance-profiling

Or do we need to expose more APIs to get this done?

@sdcb I took a wrapping approach, customizing things the way I need doing this:

        private static Action<PaddleConfig> CreateOnnxConfig(int cpuMathThreadCount = 1, bool profiling = true) {
            var configurator = PaddleDevice.Onnx(cpuMathThreadCount);
            return cfg =>
            {
                configurator(cfg);

                // Activate profiling
                cfg.ProfileEnabled = profiling;
            };
        }

This works for me, closing the ticket.