From dev-return-5996-archive-asf-public=cust-asf.ponee.io@singa.apache.org Mon Jul 13 08:22:40 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 4972D18037A for ; Mon, 13 Jul 2020 10:22:40 +0200 (CEST) Received: (qmail 17590 invoked by uid 500); 13 Jul 2020 08:22:39 -0000 Mailing-List: contact dev-help@singa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@singa.apache.org Delivered-To: mailing list dev@singa.apache.org Received: (qmail 17579 invoked by uid 99); 13 Jul 2020 08:22:39 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jul 2020 08:22:39 +0000 From: =?utf-8?q?GitBox?= To: dev@singa.apache.org Subject: =?utf-8?q?=5BGitHub=5D_=5Bsinga=5D_joddiy_edited_a_comment_on_pull_request_?= =?utf-8?q?=23760=3A_Scatter?= Message-ID: <159462855955.29655.13844877130627319881.asfpy@gitbox.apache.org> Date: Mon, 13 Jul 2020 08:22:39 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit In-Reply-To: References: 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