Sha256: bb93c1e23fffe4366eb4357511c372d896ad238976d5e48abbae4003907fa77d

Contents?: true

Size: 507 Bytes

Versions: 2

Compression:

Stored size: 507 Bytes

Contents

module TensorStream
  ##
  # Utiliity functions for creating performance reports
  class ReportTool
    def self.profile_for(session, order_by: :slowest)
      context = session.last_session_context
      eval_times = context[:profile][:operations].map do |name, profile|
        [name, profile[:op], profile[:eval_time], profile[:shape]]
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tensor_stream-1.0.0 lib/tensor_stream/profile/report_tool.rb
tensor_stream-1.0.0.pre.rc1 lib/tensor_stream/profile/report_tool.rb