singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [singa] joddiy edited a comment on pull request #760: Scatter
Date Mon, 13 Jul 2020 08:22:39 GMT

joddiy edited a comment on pull request #760:
URL: https://github.com/apache/singa/pull/760#issuecomment-657401578


   > Hi @joddiy,
   > 
   > Would we be considering only 2 dimensions for the scatter_elements operation?
   > For backwards operation with scatter_elements can we store the indexes we process
during the forward pass, this can help us reducing the time complexity for the operation?
   > Also for implementing the advanced indexing operation, we can implement it as a suboptimal
operation for processing the index as a list of tuples and further indexing only based on
those list of tuples? This can save complexity of iterating over dimension elements multiple
times
   > 
   > Thanks and Regards,
   > Shashank Nigam
   
   Hi, Shashank
   
   > Would we be considering only 2 dimensions for the scatter_elements operation?
   
   For now, all test cases are 2-d inputs, so we may only need to support the 2d inputs.
   
   > For backwards operation with scatter_elements can we store the indexes we process
during the forward pass, this can help us reducing the time complexity for the operation?
   
   Sure, of course, however, even we store the indexes, we still iterate through all these
indexes when we use them, right? it cannot reduce the time complexity.
   
   > Also for implementing the advanced indexing operation, we can implement it as a suboptimal
operation for processing the index as a list of tuples and further indexing only based on
those list of tuples? This can save complexity of iterating over dimension elements multiple
times
   
   Let us see this code, actually, for elements in the `self.updates` tensor, we use each
of them for only one time, right? even we stores these indexes as a list of tuple, we still
use each of time for one time, right? how can we save complexity of iterating? 
   ```
           u_shape = self.updates.shape
           y = _x.copy()
           for i in range(u_shape[0]):
               for j in range(u_shape[1]):
                   idx = int(self.indices[i][j])
                   if self.axis == 0:
                       y[idx][j] = self.updates[i][j]
                   else:
                       y[i][idx] = self.updates[i][j]
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message