You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to run the patch_model function with a simple MNIST NN (only linear layers) using the naive_program function as a programming routine but it crashes because of a "too many values to unpack" error stemming from the "point" parameter fed to the naive_program method that is a three element tuple while it expects a two element one. This error only happens with tiled crossbars (cause of the three element tuple) and with transistor set to False.
File "C:\Users\Phili\Documents\Ecole\UdeS\Memtorch\custom_MemTorch\memtorch\bh\crossbar\Crossbar.py", line 334, in init_crossbar
crossbars[0].write_conductance_matrix(
File "C:\Users\Phili\Documents\Ecole\UdeS\Memtorch\custom_MemTorch\memtorch\bh\crossbar\Crossbar.py", line 208, in write_conductance_matrix
self.devices = programming_routine(
File "C:\Users\Phili\Documents\Ecole\UdeS\Memtorch\custom_MemTorch\memtorch\bh\crossbar\Program.py", line 56, in naive_program
row, column = point
ValueError: too many values to unpack (expected 2)
Here are the execution parameters being fed to the patch_model:
patched_model = patch_model(copy.deepcopy(network),
memristor_model=memtorch.bh.memristor.Data_Driven,
memristor_model_params= reference_memristor_params_dd,
module_parameters_to_patch=[torch.nn.Linear],
mapping_routine=naive_map,
transistor=False,
programming_routine=memtorch.bh.crossbar.Program.naive_program,
tile_shape=(128,128),
max_input_voltage=1.0,
ADC_resolution=8,
ADC_overflow_rate=0.,
quant_method='linear')
Was it intended for the user to write his/her own programming routine? Thank you,
Philippe
The text was updated successfully, but these errors were encountered:
Thank you for raising this! Your interpretation is correct- naive_program in Program.py is indeed a fully-functional exemplar programming routine. More complex programming routines can be defined externally, that for instance, reduce the amplitude of the applied voltage over time, or apply more complex logic to program devices more effectively.
I can confirm this is indeed a bug. I'll look into this tomorrow and will provide an update when a fix is integrated and naive_program can be used with tiled crossbars.
This should now be fixed in #52. Please note that, depending on the simulation timestep used and other device parameters, operation may be quite slow. I have opened another issue (#53) to parallelize/optimize device simulation logic.
Hello,
I am trying to run the patch_model function with a simple MNIST NN (only linear layers) using the naive_program function as a programming routine but it crashes because of a "too many values to unpack" error stemming from the "point" parameter fed to the naive_program method that is a three element tuple while it expects a two element one. This error only happens with tiled crossbars (cause of the three element tuple) and with transistor set to False.
File "C:\Users\Phili\Documents\Ecole\UdeS\Memtorch\custom_MemTorch\memtorch\bh\crossbar\Crossbar.py", line 334, in init_crossbar
crossbars[0].write_conductance_matrix(
File "C:\Users\Phili\Documents\Ecole\UdeS\Memtorch\custom_MemTorch\memtorch\bh\crossbar\Crossbar.py", line 208, in write_conductance_matrix
self.devices = programming_routine(
File "C:\Users\Phili\Documents\Ecole\UdeS\Memtorch\custom_MemTorch\memtorch\bh\crossbar\Program.py", line 56, in naive_program
row, column = point
ValueError: too many values to unpack (expected 2)
Here are the execution parameters being fed to the patch_model:
patched_model = patch_model(copy.deepcopy(network),
memristor_model=memtorch.bh.memristor.Data_Driven,
memristor_model_params= reference_memristor_params_dd,
module_parameters_to_patch=[torch.nn.Linear],
mapping_routine=naive_map,
transistor=False,
programming_routine=memtorch.bh.crossbar.Program.naive_program,
tile_shape=(128,128),
max_input_voltage=1.0,
ADC_resolution=8,
ADC_overflow_rate=0.,
quant_method='linear')
Was it intended for the user to write his/her own programming routine? Thank you,
Philippe
The text was updated successfully, but these errors were encountered: