-
Notifications
You must be signed in to change notification settings - Fork 17
Refactored cpu backend: #121 #140
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
base: master
Are you sure you want to change the base?
Conversation
...ackends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/altai/altai_impl.h
Show resolved
Hide resolved
knp/backends/cpu/cpu-library/include/knp/backends/cpu-library/impl/projections/interface_fwd.h
Outdated
Show resolved
Hide resolved
...backends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/altai/interface.h
Outdated
Show resolved
Hide resolved
knp/neuron-traits-library/include/knp/neuron-traits/altai_lif.h
Outdated
Show resolved
Hide resolved
knp/backends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/blifat/stdp.h
Outdated
Show resolved
Hide resolved
knp/backends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/blifat/stdp.h
Outdated
Show resolved
Hide resolved
knp/backends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/blifat/stdp.h
Outdated
Show resolved
Hide resolved
...kends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/blifat/blifat_stdp.h
Outdated
Show resolved
Hide resolved
...kends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/blifat/blifat_stdp.h
Outdated
Show resolved
Hide resolved
| else | ||
| { | ||
| throw std::runtime_error("Type is not supported."); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это возможно сделать не ошибкой в рантайме, а ошибкой компиляции.
И последнее будет предпочтительней.
Используй static_assert, например.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тогда оно вообще не будет работать, AllVariants содержит то чего нету в SupportedTypes, и это нормально.
но в твоем случае это выдаст ошибку.
такая ошибка должна вылетать в рантайме, нельзя это определить во время компиляции
...ackends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/altai/altai_impl.h
Show resolved
Hide resolved
...kends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/blifat/blifat_stdp.h
Outdated
Show resolved
Hide resolved
knp/backends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/training/stdp.h
Show resolved
Hide resolved
knp/backends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/training/stdp.h
Show resolved
Hide resolved
.../cpu-library/include/knp/backends/cpu-library/impl/projections/training/stdp/additive_stdp.h
Show resolved
Hide resolved
knp/neuron-traits-library/include/knp/neuron-traits/altai_lif.h
Outdated
Show resolved
Hide resolved
...ackends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/altai/altai_impl.h
Show resolved
Hide resolved
...ackends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/altai/altai_impl.h
Show resolved
Hide resolved
...ackends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/altai/altai_impl.h
Show resolved
Hide resolved
...s/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/altai/altai_dispatcher.h
Show resolved
Hide resolved
...kends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/blifat/blifat_impl.h
Outdated
Show resolved
Hide resolved
knp/backends/cpu/cpu-library/include/knp/backends/cpu-library/populations_old.h
Outdated
Show resolved
Hide resolved
knp/backends/cpu/cpu-library/include/knp/backends/cpu-library/populations_old.h
Show resolved
Hide resolved
knp/backends/cpu/cpu-library/include/knp/backends/cpu-library/projections.h
Show resolved
Hide resolved
knp/neuron-traits-library/include/knp/neuron-traits/altai_lif.h
Outdated
Show resolved
Hide resolved
...ackends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/altai/altai_impl.h
Show resolved
Hide resolved
...ackends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/altai/altai_impl.h
Show resolved
Hide resolved
...ackends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/altai/altai_impl.h
Show resolved
Hide resolved
...kends/cpu/cpu-library/include/knp/backends/cpu-library/impl/populations/blifat/blifat_impl.h
Show resolved
Hide resolved
| * @param step_n Step number. | ||
| * @return Message that should be sent from queue. | ||
| */ | ||
| inline MessageQueue::const_iterator calculate_projection_dispatch( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Мне, честно говоря, очень не нравится это dispatch, как будто он не вычисляет проекцию, а занимается чем-то другим, а вычисление проекции надо отдельно.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
почему другим? тут весь код вычисления проекции, больше кода с проекциями нету, отделять нечего, только если еще больше разбивать функцию
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Я конкретно про слово dispatch в названии функции. Когда пользователь её вызывает, он по идее ожидает что она что-то продиспетчеризует - направит, вышлет или распределит, нет? А она возьмёт и вычислит что-то вместо этого. У нас там есть типа dispatch messages, и оно раскидывает сообщения, а это по идее рассчитывает.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
согласен, если просто смотреть на название то может возникнуть недопонимание, но это не функция которую будет вызывать пользователь, это просто функция распределитель, она вызывается другими распределителями, пользователь ее впринципе не вызывает.
но можно было бы придумать как назвать получше, мб что то по типу "calculate_projection__dispatch" что бы разделить смысл?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не знаю, я бы может быть убрал dispatch вообще, она вычисляет проекцию. На самом деле, я не знаю, calculate_general_projection или что-то подобное, может быть? Потому что да, по названию это вызов какой-то диспетчеризации, а вызывается вычисление, название обманчивое.
Now its easier to add new types of synapses and neurons. Code reading should be easier.