From: Francois Fleuret Date: Tue, 6 Dec 2016 10:02:35 +0000 (+0100) Subject: Added a proper error when trying to print the timing for an undecorated model. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=3debf6e5063b03dc620d2ed67c6c155245bfedd8;p=profiler-torch.git Added a proper error when trying to print the timing for an undecorated model. --- diff --git a/profiler.lua b/profiler.lua index 4fec258..f57c9d8 100644 --- a/profiler.lua +++ b/profiler.lua @@ -115,6 +115,10 @@ function profiler.print(model, nbSamples, totalTime, indent) local indent = indent or '' local hint + if not model.accTime then + error('The model does not seem decorated for profiling.') + end + local localTotal = 0 for _, t in pairs(model.accTime) do localTotal = localTotal + t