Coder Social home page Coder Social logo

Comments (13)

MessikommerNico avatar MessikommerNico commented on July 24, 2024

Yes, that should be possible. If you want to propagate the change of the added site further down the network, you also need to update the active_sites_map.

from rpg_asynet.

978326187 avatar 978326187 commented on July 24, 2024

image
i think i should make some change input_locations and output_locations. am i right?
actually, i am confused with the code from line 151-181.

from rpg_asynet.

978326187 avatar 978326187 commented on July 24, 2024

i find that the input_locations and output_locations are one-to-one, shouldn't it be related with filter_size?

from rpg_asynet.

MessikommerNico avatar MessikommerNico commented on July 24, 2024

A rule in the rule book specifies the connection between neurons i.e. input and output location. Thus, it is always one-to-one. An input site is usually connected to multiple output site, therefore mutliple rules can contain the same input site.
The python code is implemented to achieve as much as possible in matrix form. Maybe it is easier to read the cpp code:
https://github.com/uzh-rpg/rpg_asynet/blob/master/async_sparse_py/src/conv2d.cpp

from rpg_asynet.

978326187 avatar 978326187 commented on July 24, 2024

i think if i wanna adding rules i should change active_sites_to_update, but how can i know whether the rules is rightful?
for example, if i use active_sites_to_update.append([3, 3]) it doesn't report any error, but if i use active_sites_to_update.append([0, 3]), it shows a traceback:
Traceback (most recent call last):
File "test.py", line 91, in
asyn_output = asyn_model.forward(x_asyn)
File "/storage/rpg_asynet-master/models/asyn_sparse_vgg.py", line 49, in forward
rule_book_output=None)
File "/storage/rpg_asynet-master/layers/conv_layer_2D.py", line 123, in forward
output_feature_map.index_add_(dim=0, index=flattend_indices, source=update_term)
IndexError: index out of range in self

from rpg_asynet.

MessikommerNico avatar MessikommerNico commented on July 24, 2024

active_sites_to_update just relates to the current update_location. It is not the right place to add new rules
I am not quite sure what your goal is. What do you do if the new rule connects to an inactive output site?
In general, you can append new rules directly to the rulebook in https://github.com/uzh-rpg/rpg_asynet/blob/master/layers/conv_layer_2D.py#L178
But you need to be sure how to update the active site map.

from rpg_asynet.

978326187 avatar 978326187 commented on July 24, 2024

I want to see if adding rules can improves performance of asynet. i also want to use a if block to handle the inactive case.
i find that the size of rule_book_output and rule_book_input is equal, does it mean i should update these two variables at the same time?

from rpg_asynet.

MessikommerNico avatar MessikommerNico commented on July 24, 2024

Yes, the rule book defines for each kernel index the input and output sites. So there is a one to one mapping between rule_book_input to rule_book_output. So you need to update both books to add a new rule

from rpg_asynet.

978326187 avatar 978326187 commented on July 24, 2024

can i just append output_locations[i_active_site]+1 to achieve my goal?
or i should consider about position_kernels and output_locations

from rpg_asynet.

MessikommerNico avatar MessikommerNico commented on July 24, 2024

You should consider all of the three and additionally also the active sites map.
Moreover, if you want to extend the rules based on your image, you also need to increase the kernel size.

from rpg_asynet.

978326187 avatar 978326187 commented on July 24, 2024

ok, thanks for your reply~

from rpg_asynet.

978326187 avatar 978326187 commented on July 24, 2024

what does the variable active_sites_to_update conclude?
i find that this variable is related to rule_book_output and rule_book_inout, more specifically, active_sites_to_update[:, 0] is related to rule_book_inout and active_sites_to_update[:, 1] is related to rule_book_output.
when i append a new site to active_sites_to_update, the program showed the error below.

 File "asyn_model_test.py", line 120, in <module>
    asyn_output = asyn_model.forward(x_asyn)
  File "/storage/rpg_asynet-master/models/asyn_sparse_vgg.py", line 49, in forward
    rule_book_output=None)
  File "/storage/rpg_asynet-master/layers/conv_layer_2D.py", line 123, in forward
    output_feature_map.index_add_(dim=0, index=flattend_indices, source=update_term)
IndexError: index out of range in self

from rpg_asynet.

MessikommerNico avatar MessikommerNico commented on July 24, 2024

The variable active_sites_to_update includes the relative kernel indices of the active sides in the receptive field of the sites stored in update_location, which have at least one active site in the receptive field. So it is coupled to update_location variable, which is given as input to the function.
As I said before, active_sites_to_update is not the right place to append new rules. Add the rules directly to the rulebook in https://github.com/uzh-rpg/rpg_asynet/blob/master/layers/conv_layer_2D.py#L178

from rpg_asynet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.