torch.autograd.ProfilerContext
class ProfilerContextnew ProfilerContext(private options: ProfilerOptions = {})
Profiler context that can be used with with statement pattern.
In JavaScript, use try/finally pattern instead.
Examples
const prof = torch.autograd.profiler.profile();
prof.start();
try {
// ... operations to profile
} finally {
prof.stop();
console.log(prof.key_averages());
}