Skip to content

vbo12345/rf_spintronic_nn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RF spintronic neural networks

This repository contains the code to simulate hardware artificial neural networks where neurons and synapses are implemented by radiofrequency spintronic devices.

The RF spintronic neural network concept and experimental demonstration can be found in the article "Multilayer spintronic neural networks with radio-frequency connections" by Ross, Leroux et al. [1], available here

In particular, this code can be used to reproduce the results of the drone classification task, which dataset can be downloaded here and is inspired from [2].

Setup

In order to avoid potential conflicts with other packages it is strongly recommended to use a virtual environment (venv) or a conda environment. The dependencies are:

The requirements.yml file can be used to create the environment with the command:

conda env create --name environment_name --file requirements.yml
conda activate environment_name

Reproduce the procedure used to obtain the results of Figure 4 of our paper.

fig4b

Disclaimer: While it is possible for us to reproduce exactly the accuracy given in the paper, the results are not exactly reproducible if the code run on an other machine. This is actually a known issue (see Pytorch forum). However, it is expected that you find very close results.

In order to reproduce the training and evaluation procedure for the spintronic MLP and the standard MLP, we need two commands:

  • Execute the code with the spintronic MLP model:
python main.py --procedure train_eval --config config_spinMLP.yaml
  • Execute the code with the standard MLP model:
python main.py --procedure train_eval --config config_MLP.yaml  

The results will be saved in the directory results/train_eval under the names YYYYmmdd-HHMMSS-<model_name>.

Wider usage

The code can run three different procedures:

  • Selection of the best hyper-parameters followed by training and evaluation of a network on the entire dataset
python main.py --procedure select_train_eval  
  • Training and evaluation of a network
python main.py --procedure train_eval  
  • Evaluation of an existing model (need to load one) on the test dataset
python main.py --procedure eval  --config <path_to_config_from_results>

The results are saved in the results directory where there is one directory for each procedure.

By default, the physical model do not consider the nonidealities of the magnetic tunnel junctions. To take into account the nonidealities you have to use the argument --with-nonidealities:

python main.py --procedure select_train_eval --with-nonidealities

The nonidealities that are implemented as the variation of the resonance frequencies, the variation of the frequency and the power of the output signal of the oscillators. It can be adjusted using the arguments --freq-var-percentage and --power-var-percentage:

python main.py --procedure select_train_eval --with-nonidealities --freq-var-percentage 0.001 --power-var-percentage 0.001  

where 1.0 corresponds to 100%.

References

[1] Ross, A., Leroux, N., de Riz, A., Marković, D., Sanz-Hernández, D., Trastoy, J., ... & Grollier, J. (2022). "Multilayer spintronic neural networks with radio-frequency connections". arXiv preprint arXiv:2211.03659.

[2] S. Basak, S. Rajendran, S. Pollin and B. Scheers, "Drone classification from RF fingerprints using deep residual nets," 2021 International Conference on COMmunication Systems & NETworkS (COMSNETS), Bangalore, India, 2021, pp. 548-555, doi: 10.1109/COMSNETS51098.2021.9352891. link to dataset.

About

RF spintronic neural network simulator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%