예제 #1
0
class TTv2EcRamPreset(UnitCellRPUConfig):
    """Configuration using TTv2 with
    :class:`~aihwkit.simulator.presets.devices.EcRamPresetDevice`.

    See :class:`~aihwkit.simulator.configs.devices.BufferedTransferCompound`
    for details on TTv2-like optimizers.

    The default peripheral hardware
    (:class:`~aihwkit.simulator.presets.utils.PresetIOParameters`) and
    analog update
    (:class:`~aihwkit.simulator.presets.utils.PresetUpdateParameters`)
    configuration is used otherwise.
    """

    device: UnitCell = field(
        default_factory=lambda: BufferedTransferCompound(
            unit_cell_devices=[EcRamPresetDevice(), EcRamPresetDevice()],
            transfer_forward=PresetIOParameters(),
            transfer_update=PresetUpdateParameters(),
            transfer_every=1.0,
            units_in_mbatch=True,
            ))
    forward: IOParameters = field(default_factory=PresetIOParameters)
    backward: IOParameters = field(default_factory=PresetIOParameters)
    update: UpdateParameters = field(default_factory=PresetUpdateParameters)
예제 #2
0
class EcRam4Preset(UnitCellRPUConfig):
    """Preset configuration using four Lithium-based EcRam devices per cross-point
    (:class:`~aihwkit.simulator.presets.devices.EcRamPresetDevice`),
    where both are updated with random selection policy for update.

    See :class:`~aihwkit.simulator.configs.devices.VectorUnitCell` for
    more details on multiple devices per cross-points.

    The default peripheral hardware
    (:class:`~aihwkit.simulator.presets.utils.PresetIOParameters`) and
    analog update
    (:class:`~aihwkit.simulator.presets.utils.PresetUpdateParameters`)
    configuration is used otherwise.
    """

    device: UnitCell = field(default_factory=lambda: VectorUnitCell(
        unit_cell_devices=[
            EcRamPresetDevice(),
            EcRamPresetDevice(),
            EcRamPresetDevice(),
            EcRamPresetDevice()
        ],
        update_policy=VectorUnitCellUpdatePolicy.SINGLE_RANDOM))
    forward: IOParameters = field(default_factory=PresetIOParameters)
    backward: IOParameters = field(default_factory=PresetIOParameters)
    update: UpdateParameters = field(default_factory=PresetUpdateParameters)
예제 #3
0
class MixedPrecisionEcRamPreset(DigitalRankUpdateRPUConfig):
    """Configuration using Mixed-precision with
    class:`~aihwkit.simulator.presets.devices.EcRamPresetDevice`.

    See class:`~aihwkit.simulator.configs.devices.MixedPrecisionCompound`
    for details on the mixed precision optimizer.

    The default peripheral hardware
    (:class:`~aihwkit.simulator.presets.utils.PresetIOParameters`) and
    analog update
    (:class:`~aihwkit.simulator.presets.utils.PresetUpdateParameters`)
    configuration is used otherwise.
    """

    device: DigitalRankUpdateCell = field(
        default_factory=lambda: MixedPrecisionCompound(device=
                                                       EcRamPresetDevice(), ))
    forward: IOParameters = field(default_factory=PresetIOParameters)
    backward: IOParameters = field(default_factory=PresetIOParameters)
    update: UpdateParameters = field(default_factory=PresetUpdateParameters)
예제 #4
0
from aihwkit.simulator.presets.devices import (ReRamSBPresetDevice,
                                               ReRamESPresetDevice,
                                               CapacitorPresetDevice,
                                               EcRamPresetDevice,
                                               IdealizedPresetDevice)

plt.ion()

# ReRam based on ExpStep
plot_device(ReRamESPresetDevice(), n_steps=1000)
plot_device_compact(ReRamESPresetDevice(), n_steps=1000)

# ReRam based on SoftBounds
plot_device(ReRamSBPresetDevice(), n_steps=1000)
plot_device_compact(ReRamSBPresetDevice(), n_steps=1000)

# Capacitor
plot_device(CapacitorPresetDevice(), n_steps=400)
plot_device_compact(CapacitorPresetDevice(), n_steps=400)

# ECRAM
plot_device(EcRamPresetDevice(), n_steps=1000)
plot_device_compact(EcRamPresetDevice(), n_steps=1000)

# Idealized
plot_device(IdealizedPresetDevice(), n_steps=10000)
plot_device_compact(IdealizedPresetDevice(), n_steps=10000)

plt.show()
예제 #5
0
    PCMPresetUnitCell,
)

plt.ion()

# Note alternatively one can use plot_device_compact for a more compact
# plot.

# Idealized
plot_device(IdealizedPresetDevice(), n_steps=10000)

# ReRam based on ExpStep
plot_device(ReRamESPresetDevice(), n_steps=1000)

# ReRam based on SoftBounds
plot_device(ReRamSBPresetDevice(), n_steps=1000)

# Capacitor
plot_device(CapacitorPresetDevice(), n_steps=400)

# ECRAM
plot_device(EcRamPresetDevice(), n_steps=1000)

# Mo-ECRAM
plot_device(EcRamMOPresetDevice(), n_steps=8000)

# PCM
plot_device(PCMPresetUnitCell(), n_steps=80)

plt.show()