aihwkit.utils.export module

Exporting utilities

aihwkit.utils.export.fusion_export(analog_model, g_converter=None, file_name=None)[source]

Exports an analog module for inference on the Fusion chip.

Parameters:
  • analog_model (Module) – The analog model to export weights from. It is assumed that weights are stored in InferenceTile

  • g_converter (BaseConductanceConverter | None) – the conductance converter to be used. If non given FusionConductanceConverter is used.

  • file_name (str | None) – if give, will be used to export the CSV file to upload to the composer.

Raises:

TileError – if the analog tiles are not derived from InferenceTile

Return type:

Tuple[Dict, Dict]

aihwkit.utils.export.fusion_import(conductance_data, analog_model, state_dict=None, g_converter=None)[source]

Imports the data from the Fusion chip and sets the model weights.

Parameters:
  • conductance_data (OrderedDict | str) – Either the data dictionary or filename from the fuction experiment

  • analog_model (Module) – The analog model used for export. It will be changed in place.

  • state_dict (Dict | None) –

    the state_dict of the model to initialize the same weights as when using fusion_export()

    Caution

    If not given the weights of the model are simply overwritte, however, it is assumed that the weights are the very same as during the fusion_export() call and not check is done to ensure it.

  • g_converter (BaseConductanceConverter | None) – The same g-converter used for fusion_export()

Returns:

Model with the given layer conductance data applied. The model will be in eval mode.

Raises:
Return type:

Module