Repository: IBM/aihwkit (language: python)

Issue:
Add test for analog presets
## Related issues

#133 

## Description

Follow-up to #144 adding a parameterized test over the analog presets. The test itself is rather light and focusing on instantiation and the basic operation, as the rest of the functionality should already be covered for `RPUConfig` in general in other tests.

In the process:
* added `write_noise_std` as attributes of the bindings, as they were needed by some presets.
* added a parameterizer decorator
* revised the list of convenience imports

## Details

<!-- A more elaborate description of the changes, if needed. -->

Add test for analog presets
## Related issues

#133 

## Description

Follow-up to #144 adding a parameterized test over the analog presets. The test itself is rather light and focusing on instantiation and the basic operation, as the rest of the functionality should already be covered for `RPUConfig` in general in other tests.

In the process:
* added `write_noise_std` as attributes of the bindings, as they were needed by some presets.
* added a parameterizer decorator
* revised the list of convenience imports

## Details

<!-- A more elaborate description of the changes, if needed. -->

Include analog device presets
## Description and motivation

While using the family of `RPUConfig` devices and adjust their parameters manually offers a great deal of flexibility, for some use cases being able to start with a set of pre-defined interesting configurations would be useful. This would help the users being familiar with the different options, serve as a basis for exploring the toolkit, and allow using "well-known" configurations off the shelf for a number of purposes.

## Proposed solution

Add a number of curated analog device presets to the package, representing devices in existing literature or other specific configurations that seem relevant or interesting.

## Alternatives and other information

<!-- A clear and concise description of any alternative solutions or features you've considered. -->



Discussion / hints:


Closed via #144

Fix patch:
diff --git a/src/aihwkit/simulator/configs/devices.py b/src/aihwkit/simulator/configs/devices.py
index 96c2df4c..0617d407 100644
--- a/src/aihwkit/simulator/configs/devices.py
+++ b/src/aihwkit/simulator/configs/devices.py
@@ -445,6 +445,21 @@ class LinearStepDevice(PulsedDevice):
     """Whether to use multiplicative noise instead of additive
     cycle-to-cycle noise"""
 
+    write_noise_std: float = 0.0
+    r"""Whether to use update write noise that is added to the updated
+    devices weight, while the update is done on a hidden persistent weight. The
+    update write noise is then sampled a new when the device is touched
+    again.
+
+    Thus it is:
+
+    .. math::
+       w_\text{apparent}{ij} = w_ij + \sigma_\text{write_noise}\xi
+
+    and the update is done on :math:`w_ij` but the forward sees the
+    :math:`w_\text{apparent}`.
+    """
+
 
 @dataclass
 class SoftBoundsDevice(PulsedDevice):
@@ -519,6 +534,21 @@ class ExpStepDevice(PulsedDevice):
     b: float = 0.2425
     """Global offset parameter"""
 
+    write_noise_std: float = 0.0
+    r"""Whether to use update write noise that is added to the updated
+    devices weight, while the update is done on a hidden persistent weight. The
+    update write noise is then sampled a new when the device is touched
+    again.
+
+    Thus it is:
+
+    .. math::
+       w_\text{apparent}{ij} = w_ij + \sigma_\text{write_noise}\xi
+
+    and the update is done on :math:`w_ij` but the forward sees the
+    :math:`w_\text{apparent}`.
+    """
+
 
 ###############################################################################
 # Specific devices based on ``unit cell``.


Test patch:
diff --git a/tests/helpers/decorators.py b/tests/helpers/decorators.py
index 305158b7..e931fb5b 100644
--- a/tests/helpers/decorators.py
+++ b/tests/helpers/decorators.py
@@ -97,7 +97,7 @@ def parametrize_over_presets(presets: List) -> Callable:
 
     def class_name(cls, _, params_dict):
         """Return a user-friendly name for a parametrized test."""
-        return '{}_{}'.format(cls.__name__, params_dict['preset_cls'])
+        return '{}_{}'.format(cls.__name__, params_dict['preset_cls'].__name__)
 
     return parameterized_class(
         [{'preset_cls': preset} for preset in presets],