Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Problem of Computing SyOPs in SNN Model #12

Open
ZHENG2049 opened this issue Mar 19, 2024 · 0 comments
Open

The Problem of Computing SyOPs in SNN Model #12

ZHENG2049 opened this issue Mar 19, 2024 · 0 comments

Comments

@ZHENG2049
Copy link

In your paper, I saw that you compared the Energy Efficiency of EMS-ResNet with ANN-Res, MS-Res, and Sew-Res. You provided the firing rate in the paper, but I could not find information on SyOPs, which, according to the formula you provided, $E_b=T\times(fr\times E_{AC}\times OP_{AC}+E_{MAC}\times OP_{MAC}) (6)$ , should be an important indicator of the model's Energy Consumption. I saw potentially related code in your calculate_fr.py:

attention_name = "mem_update.forward"
fr=np.zeros(len(cache[attention_name]))
at_size=np.zeros(len(cache[attention_name]))
for att_index in range(len(cache[attention_name])):
    # visualize_grid_to_grid(save_dir,att_index,attention_name,att_map,image)
    fr[att_index]=cache[attention_name][att_index].sum()/cache[attention_name][att_index].size
for att_index in range(len(cache[attention_name])):
    at_size[att_index]=cache[attention_name][att_index].size
# calculate firing rate
FR.append(fr)
SZ.append(at_size)

SZ seem to be attempting to calculate the number of operations in mem_update, but I encountered some issues when running the code:

Traceback (most recent call last):
File "/home/ps/EMS-YOLO/calculate_fr.py", line 355, in <module>
  main(opt)
File "/home/ps/EMS-YOLO/calculate_fr.py", line 361, in main
  run(**vars(opt))
File "/home/ps/miniconda3/envs/emsyolo/lib/python3.9/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
  return func(*args, **kwargs)
File "/home/ps/EMS-YOLO/calculate_fr.py", line 235, in run
  fr=np.zeros(len(cache[attention_name]))
KeyError: 'mem_update.forward'

How can I solve this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant