This class is able to measure time (in seconds) elapsed in a particular period. Example:

  timer = torch.Timer() -- the Timer starts to count now
  x = 0
  for i=1,1000000 do
    x = x + math.sin(x)
  end
  print('Time elapsed for 1,000,000 sin: ' .. timer:time() .. ' seconds')

Subsections

  1. torch.Timer()
  2. [self] reset()
  3. [self] resume()
  4. [self] stop()
  5. [number] time()