profilers module
These are subcallbacks reachable by Profiler
.
When you try to access a subcallback (like computation
), like this:
l = k1lib.Learner.sample()
l.cbs.add(Cbs.Profiler())
l.Profiler.computation # accessing the field
...Profiler will temporarily attaches a specific subcallback, runs it, stores
data, and then detachs it, so that you can only access it via l.Profiler.computation
later on. Subsequent accesses don’t actually run the subcallback again, but just
displays the cached value.
computation module
- class k1lib.callbacks.profilers.computation.ComputationProfiler(profiler: Profiler)[source]
Bases:
Callback
Profiles computation. Only provide reports on well known layers only, and thus can’t really be universal. Example:
l = k1lib.Learner.sample() l.cbs.add(Cbs.Profiler()) # views table l.Profiler.computation # views table highlighted l.Profiler.computation.css("#lin1 > #lin")
- css(css: str)[source]
Selects a small part of the network to highlight. See also:
k1lib.selector
.
io module
- class k1lib.callbacks.profilers.io.IOProfiler[source]
Bases:
Callback
Gets input and output shapes of each layer. Example:
l = k1lib.Learner.sample() l.cbs.add(Cbs.Profiler()) # views table l.Profiler.io # views table highlighted l.Profiler.io.css("#lin1")
- css(css: str)[source]
Selects a small part of the network to highlight. See also:
k1lib.selector
.
memory module
- class k1lib.callbacks.profilers.memory.MemoryProfiler[source]
Bases:
Callback
Expected to be run only once only. If a new report for a new network architecture is required, then create a new one. Example:
l = k1lib.Learner.sample() l.cbs.add(Cbs.Profiler()) # views graph and table l.Profiler.memory # views graph and table highlighted l.Profiler.memory.css("Linear")
- css(css: str)[source]
Selects a small part of the network to highlight. See also:
k1lib.selector
.
time module
- class k1lib.callbacks.profilers.time.TimeProfiler[source]
Bases:
Callback
Profiles execution time. Only measures forward times, as backward times can’t really be measured. Example:
l = k1lib.Learner.sample() l.cbs.add(Cbs.Profiler()) # views table l.Profiler.time # views table highlighted l.Profiler.time.css("#lin1")
- css(css: str)[source]
Selects a small part of the network to highlight. See also:
k1lib.selector
.