carbonai.MagicPowerMeter¶
- class carbonai.MagicPowerMeter(**kwargs)¶
This class will be used to use a PowerMeter instance in a notebook cell.
This class aims at allowing the usage of ipython magic functions. It is not made to be used alone
- Parameters
- MagicsIPythonShell
An ipython shell
See also
MagicPowerMeter.measure_powerMeasure the power consumption using a ipython magic function
PowerMeterInstanciate a PowerMeter
Examples
Load the
MagicPowerMeterextension then declare a PowerMeter as usual%load_ext carbonai.MagicPowerMeter from carbonai import PowerMeter power_meter = PowerMeter(project_name="MNIST classifier", is_online=False, location="FR")
- Attributes
- config
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Subclasses can declare default classes by overriding the klass attribute
cross_validation_lockA contextmanager for running a block with our cross validation lock set to True.
- options_table
- parent
A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Subclasses can declare default classes by overriding the klass attribute
- shell
Methods
add_traits(**traits)Dynamically add trait attributes to the HasTraits instance.
arg_err(func)Print docstring if incorrect arguments were passed
class_config_rst_doc()Generate rST documentation for this class’ config options.
class_config_section([classes])Get the config section for this class.
class_get_help([inst])Get the help string for this class in ReST format.
class_get_trait_help(trait[, inst, helptext])Get the helptext string for a single trait.
class_own_trait_events(name)Get a dict of all event handlers defined on this class, not a parent.
class_own_traits(**metadata)Get a dict of all the traitlets defined on this class, not a parent.
class_print_help([inst])Get the help string for a single trait and print it.
class_trait_names(**metadata)Get a list of all the names of this class’ traits.
class_traits(**metadata)Get a
dictof all the traits of this class.default_option(fn, optstr)Make an entry in the options_table for fn, with value optstr
format_latex(strng)Format a string for latex inclusion.
has_trait(name)Returns True if the object has a trait with the specified name.
hold_trait_notifications()Context manager for bundling trait change notifications and cross validation.
measure_power(line, cell).
notify_change(change)Notify observers of a change event
observe(handler[, names, type])Setup a handler to be called when a trait changes.
on_trait_change([handler, name, remove])DEPRECATED: Setup a handler to be called when a trait changes.
parse_options(arg_str, opt_str, *long_opts, **kw)Parse options passed to an argument string.
section_names()return section names as a list
set_trait(name, value)Forcibly sets trait attribute, including read-only attributes.
setup_instance(**kwargs)This is called before self.__init__ is called.
trait_defaults(*names, **metadata)Return a trait’s default value or a dictionary of them
trait_events([name])Get a
dictof all the event handlers of this class.trait_has_value(name)Returns True if the specified trait has a value.
trait_metadata(traitname, key[, default])Get metadata values for trait by key.
trait_names(**metadata)Get a list of all the names of this class’ traits.
trait_values(**metadata)A
dictof trait names and their values.traits(**metadata)Get a
dictof all the traits of this class.unobserve(handler[, names, type])Remove a trait change handler.
unobserve_all([name])Remove trait change handlers of any type for the specified name.
update_config(config)Update config and load the new values