pytorchart.presets package

Submodules

pytorchart.presets.functional module

class pytorchart.presets.functional.LayerLegend[source]

Bases: object

keeps track of layers and assigned Colors

color_for(layer)[source]
register_model(model, fn=<function <lambda>>)[source]
pytorchart.presets.functional.gen_grad_wrt_w(fn)[source]
pytorchart.presets.functional.gen_module_wght(fn)[source]
pytorchart.presets.functional.generate_layers(model, colors=None, fn=None, targets=[])[source]
Parameters:
  • model
  • colors
  • fn
  • targets
Returns:

pytorchart.presets.functional.grad_mean(module, grad_in, grad_out)[source]
pytorchart.presets.functional.grad_norm(module, grad_in, grad_out)[source]
pytorchart.presets.functional.grad_norm_mean(module, grad_in, grad_out)[source]
pytorchart.presets.functional.grad_std(module, grad_in, grad_out)[source]
pytorchart.presets.functional.has_grad(name, module_type)[source]
pytorchart.presets.functional.summarize(model, fn=<function _identity>)[source]

Given a nn.Module, recursively walk its submodules and apply a function

Parameters:
  • model – nn.Module or superclass thereof
  • fn – function to be applied to any module to create a summary
Returns:

list of summaries generated by fn(module)

pytorchart.presets.preconfigured module

class pytorchart.presets.preconfigured.Config[source]

Bases: object

Static object for generating meter and plot configurations

classmethod default_cfg()[source]

return a the base configuration for plot and meter :return: dict

Usage:

Config.default_cfg()

classmethod gen_plot(*keys, phases=None, plot=None)[source]

Creates a plot from the specified keys.

Parameters:
  • keys – list of strings
  • phases – list of strings or None. If None, it will use default

phases of [‘test’, [‘train’] :param plot: name of plot

Returns:tuple of dicts for plots and meters
classmethod get_presets(*keys, phases=None)[source]

generate a dictionary of plots and meters given preconfigured keys. This will create a meter by key by phase.

Parameters:
  • keys – list of strings
  • phases – list of strings or None. If None, it will use default

phases of [‘test’, [‘train’]

Returns:tuple of dicts for plots and meters
pytorchart.presets.preconfigured.get_meters(*keys, phases=['train', 'test'])[source]
pytorchart.presets.preconfigured.preset_names()[source]

Get a list of configured plots

Returns:list of strings

Module contents