/
usr
/
local
/
lib64
/
python3.6
/
site-packages
/
torch
/
include
/
torch
/
csrc
/
jit
/
runtime
/
/usr/local/lib64/python3.6/site-packages/torch/include/torch/csrc/jit/runtime
mkdir
upload
Name
Size
Mode
Actions
argument_spec.h
16896
0644
edit
dl
rm
autodiff.h
3993
0644
edit
dl
rm
calculate_necessary_args.h
2100
0644
edit
dl
rm
custom_operator.h
1079
0644
edit
dl
rm
exception_message.h
639
0644
edit
dl
rm
graph_executor.h
4477
0644
edit
dl
rm
graph_executor_impl.h
3902
0644
edit
dl
rm
graph_iterator.h
4963
0644
edit
dl
rm
instruction.h
3894
0644
edit
dl
rm
interpreter.h
5081
0644
edit
dl
rm
jit_exception.h
270
0644
edit
dl
rm
logging.h
2618
0644
edit
dl
rm
operator.h
9060
0644
edit
dl
rm
operator_options.h
189
0644
edit
dl
rm
print_handler.h
340
0644
edit
dl
rm
profiling_graph_executor_impl.h
2036
0644
edit
dl
rm
profiling_record.h
8962
0644
edit
dl
rm
register_ops_utils.h
43794
0644
edit
dl
rm
script_profile.h
2532
0644
edit
dl
rm
slice_indices_adjust.h
821
0644
edit
dl
rm
symbolic_script.h
598
0644
edit
dl
rm
symbolic_shape_registry.h
425
0644
edit
dl
rm
vararg_functions.h
1023
0644
edit
dl
rm
variable_tensor_list.h
545
0644
edit
dl
rm
Edit:
/usr/local/lib64/python3.6/site-packages/torch/include/torch/csrc/jit/runtime/script_profile.h
(2532B)
#pragma once #include <chrono> #include <map> #include <string> #include <ATen/core/ivalue.h> #include <c10/macros/Macros.h> #include <torch/csrc/jit/frontend/source_ref.h> #include <torch/csrc/jit/ir/ir.h> namespace torch { namespace jit { namespace profiling { struct Datapoint { using Timepoint = std::chrono::time_point<std::chrono::steady_clock>; SourceRange sourceRange; Timepoint start; Timepoint end; explicit Datapoint(SourceRange sr) : sourceRange(std::move(sr)), start(std::chrono::steady_clock::now()) {} }; class TORCH_API InstructionSpan { public: explicit InstructionSpan(Node&); ~InstructionSpan(); InstructionSpan(InstructionSpan&&) = delete; InstructionSpan& operator=(InstructionSpan&&) = delete; private: std::unique_ptr<Datapoint> datapoint_; }; } // namespace profiling struct TORCH_API InstructionStats : public CustomClassHolder { int64_t count{0}; std::chrono::nanoseconds duration{0}; }; class TORCH_API SourceStats : public CustomClassHolder { public: using LineMap = c10::Dict<int64_t, c10::intrusive_ptr<InstructionStats>>; SourceStats(SourceRef source, LineMap lineMap) : source_(std::move(source)), lineMap_(std::move(lineMap)) {} const SourceRef& getSourceRef() const { return source_; } const LineMap& getLineMap() const { return lineMap_; } private: SourceRef source_; LineMap lineMap_; }; /** * ScriptProfile is an underlying C++ implementation for TorchScript profiling. * The profiling section is specified by calling enable() and disable(): * * ... * scriptProfile.enable(); * ... * (scripts) * ... * scriptProfile.disable(); * ... * * To retrieve collected runtime data, users may call dumpStats() and do * arbitrary filtering on the data they want. Note that dumpStats() should * not be called inside a profiling section. * In general, stats are aggregated per source function body, and then by line * number. */ class TORCH_API ScriptProfile : public CustomClassHolder { // Aggregates datapoints by function source id, then by line number. using LineMap = std::map<int64_t, InstructionStats>; using SourceMap = std::map<SourceRef, LineMap, std::less<>>; public: void enable(); void disable(); const SourceMap& dumpStats(); void addDatapoint(std::shared_ptr<profiling::Datapoint>); ~ScriptProfile() override; private: bool enabled_{false}; std::vector<std::shared_ptr<profiling::Datapoint>> datapoints_; SourceMap sourceMap_; }; } // namespace jit } // namespace torch
Save
#pragma once #include
#include
#include
#include
#include
#include
#include
namespace torch { namespace jit { namespace profiling { struct Datapoint { using Timepoint = std::chrono::time_point
; SourceRange sourceRange; Timepoint start; Timepoint end; explicit Datapoint(SourceRange sr) : sourceRange(std::move(sr)), start(std::chrono::steady_clock::now()) {} }; class TORCH_API InstructionSpan { public: explicit InstructionSpan(Node&); ~InstructionSpan(); InstructionSpan(InstructionSpan&&) = delete; InstructionSpan& operator=(InstructionSpan&&) = delete; private: std::unique_ptr
datapoint_; }; } // namespace profiling struct TORCH_API InstructionStats : public CustomClassHolder { int64_t count{0}; std::chrono::nanoseconds duration{0}; }; class TORCH_API SourceStats : public CustomClassHolder { public: using LineMap = c10::Dict
>; SourceStats(SourceRef source, LineMap lineMap) : source_(std::move(source)), lineMap_(std::move(lineMap)) {} const SourceRef& getSourceRef() const { return source_; } const LineMap& getLineMap() const { return lineMap_; } private: SourceRef source_; LineMap lineMap_; }; /** * ScriptProfile is an underlying C++ implementation for TorchScript profiling. * The profiling section is specified by calling enable() and disable(): * * ... * scriptProfile.enable(); * ... * (scripts) * ... * scriptProfile.disable(); * ... * * To retrieve collected runtime data, users may call dumpStats() and do * arbitrary filtering on the data they want. Note that dumpStats() should * not be called inside a profiling section. * In general, stats are aggregated per source function body, and then by line * number. */ class TORCH_API ScriptProfile : public CustomClassHolder { // Aggregates datapoints by function source id, then by line number. using LineMap = std::map
; using SourceMap = std::map
>; public: void enable(); void disable(); const SourceMap& dumpStats(); void addDatapoint(std::shared_ptr
); ~ScriptProfile() override; private: bool enabled_{false}; std::vector
> datapoints_; SourceMap sourceMap_; }; } // namespace jit } // namespace torch