コード例 #1
0
ファイル: configs.py プロジェクト: kaoutar55/aihwkit
class TTv2ReRamESPreset(UnitCellRPUConfig):
    """Configuration using TTv2 with
    :class:`~aihwkit.simulator.presets.devices.ReRamESPresetDevice`.

    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=[ReRamESPresetDevice(), ReRamESPresetDevice()],
            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
ファイル: configs.py プロジェクト: tunghoang290780/aihwkit
class ReRamES4Preset(UnitCellRPUConfig):
    """Preset configuration using four ReRam devices per cross-point
    (:class:`~aihwkit.simulator.presets.devices.ReRamESPresetDevice`),
    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=[
            ReRamESPresetDevice(),
            ReRamESPresetDevice(),
            ReRamESPresetDevice(),
            ReRamESPresetDevice()
        ],
        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
ファイル: configs.py プロジェクト: tunghoang290780/aihwkit
class MixedPrecisionReRamESPreset(DigitalRankUpdateRPUConfig):
    """Configuration using Mixed-precision with
    class:`~aihwkit.simulator.presets.devices.ReRamESPresetDevice`

    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=ReRamESPresetDevice(), ))
    forward: IOParameters = field(default_factory=PresetIOParameters)
    backward: IOParameters = field(default_factory=PresetIOParameters)
    update: UpdateParameters = field(default_factory=PresetUpdateParameters)
コード例 #4
0
ファイル: 10_plot_presets.py プロジェクト: sycomix/aihwkit
"""

import matplotlib.pyplot as plt

from aihwkit.utils.visualization import plot_device, plot_device_compact

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
コード例 #5
0
    EcRamPresetDevice,
    IdealizedPresetDevice,
    EcRamMOPresetDevice,
    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)