profiler

    • ValueError – 如果state取值不在 [‘CPU’, ‘GPU’, ‘All’]中,或sorted_key取值不在 [None, ‘calls’, ‘total’, ‘max’, ‘min’, ‘ave’]中,则抛出异常。
    1. #### sorted_key = 'total', 'calls', 'max', 'min', 'ave' 结果 ####
    2. # 示例结果中,除了Sorted by number of xxx in descending order in the same thread 这句随着sorted_key变化而不同,其余均相同。
    3. # 原因是,示例结果中,上述5列都已经按从大到小排列了。
    4. -------------------------> Profiling Report <-------------------------
    5. Place: CPU
    6. Time unit: ms
    7. Sorted by total time in descending order in the same thread
    8. #Sorted by number of max in descending order in the same thread
    9. #Sorted by number of min in descending order in the same thread
    10. #Sorted by number of avg in descending order in the same thread
    11. Event Calls Total Min. Max. Ave. Ratio.
    12. thread0::conv2d 8 129.406 0.304303 127.076 16.1758 0.983319
    13. thread0::elementwise_add 8 2.11865 0.193486 0.525592 0.264832 0.016099
    14. thread0::feed 8 0.076649 0.006834 0.024616 0.00958112 0.000582432
    15. #### sorted_key = None 结果 ####
    16. -------------------------> Profiling Report <-------------------------
    17. Place: CPU
    18. Time unit: ms
    19. Sorted by event first end time in descending order in the same thread
    20. Event Calls Total Min. Max. Ave. Ratio.
    21. thread0::feed 8 0.077419 0.006608 0.023349 0.00967738 0.00775934
    22. thread0::conv2d 8 7.93456 0.291385 5.63342 0.99182 0.795243
    23. thread0::elementwise_add 8 1.96555 0.191884 0.518004 0.245693 0.196998