Class: TensorStream::ReportTool

Inherits:
Object
  • Object
show all
Defined in:
lib/tensor_stream/profile/report_tool.rb

Overview

Utiliity functions for creating performance reports

Class Method Summary collapse

Class Method Details

.profile_for(session, order_by: :slowest) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/tensor_stream/profile/report_tool.rb', line 5

def self.profile_for(session, order_by: :slowest)
  context = session.last_session_context
  eval_times = context[:profile][:operations].map { |name, profile|
    [name, profile[:op], profile[:eval_time], profile[:shape]]
  }

  if order_by == :slowest
    eval_times.sort_by { |a| a[2] }.reverse!
  else
    eval_times.sort_by { |a| a[2] }
  end
end