Sha256: 08c037e2c8cdfcfbe4d808880bc0627506e682555fc3c59319e3453e0719f92f

Contents?: true

Size: 516 Bytes

Versions: 1

Compression:

Stored size: 516 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[:eval_time], profile[:tensor].source]
      end

      if order_by == :slowest
        eval_times.sort_by { |a, b| b[1] <=> a[1] }
      else
        eval_times.sort_by { |a, b| a[1] <=> b[1] }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tensor_stream-0.9.2 lib/tensor_stream/profile/report_tool.rb