Weight refresh for one-sided materials like PCM #209
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related issues
#208
Description
To model PCM-like uni-directional materials in training mode realistically, we need to have a one sided unit cell, where the positive update is done on one and negative update on the other device and the effective weight is the difference of these two. This was available as the
DifferenceUnitCell
previosuly. However, since that caused quite some confusion, here it is renamed toOneSidedUnitCell
and the underlying rpucuda device toOneSidedRPUDevice
accordingly.Since the two devices comprising the
OneSidedUnitCell
cell have only positive updates, they will quickly saturate. It thus needs a refresh mechanism, which we provide in this PR. The refresh is here implemented as a full weight refresh everyrefresh_every
vector operations (MACS), (however: at most once per mini-batch for CUDA). Refresh is done by:a. Reading pos an neg device weight using an analog forward pass with unit vectors (defined in
refresh_forward
)b. Determining whether weight needs to be refreshed (by comparing to
refresh_upper_thres
andrefresh_lower_thres
)c. Resetting those weights which need refresh (with device-to-device and cycle-to-cycle variation setting
reset_dtod
,reset_std
, respectively)d. Rewrite the difference to one of the devices using the update pass given in
refresh_update
. Note that this is an open-loop write, and thus might result in significant errors.Example:

Details