From dev-return-3598-archive-asf-public=cust-asf.ponee.io@singa.incubator.apache.org Thu Sep 5 03:52:31 2019 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 4813A1804BB for ; Thu, 5 Sep 2019 05:52:31 +0200 (CEST) Received: (qmail 90396 invoked by uid 500); 5 Sep 2019 10:49:57 -0000 Mailing-List: contact dev-help@singa.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@singa.incubator.apache.org Delivered-To: mailing list dev@singa.incubator.apache.org Received: (qmail 90386 invoked by uid 99); 5 Sep 2019 10:49:57 -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; Thu, 05 Sep 2019 10:49:57 +0000 From: GitBox To: dev@singa.apache.org Subject: [GitHub] [incubator-singa] chrishkchris edited a comment on issue #468: Distributted module Message-ID: <156765555059.3841.11021097370661006053.gitbox@gitbox.apache.org> Date: Thu, 05 Sep 2019 03:52:30 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit chrishkchris edited a comment on issue #468: Distributted module URL: https://github.com/apache/incubator-singa/pull/468#issuecomment-527824025 > I have combined all the commits into two commits. Meanwhile, I found that the resnet.py is not compatible with the master branch modified "Add" function with broadcasting. Get the error ( assert(len(self.shape0) <= 2 and len(self.shape1) <= 2),"up till now, the dimensions of tensor a and b should less than 3" > AssertionError: up till now, the dimensions of tensor a and b should less than 3) > Since in resnet we used "out = autograd.add(out, residual)", the input to the add function should have a dimension more than 2, the assert function should return always false and hence assertion error When I disable the assertion `assert(len(self.shape0) <= 2 and len(self.shape1) <= 2)`, the resnet.py can run successfully See the code of Add function ```python class Add(Operation): def __init__(self): super(Add, self).__init__() def forward(self, a, b): #up till now, the dimensions of tensor a and b should less than 3 self.shape0=list(a.shape()) self.shape1=list(b.shape()) assert(len(self.shape0) <= 2 and len(self.shape1) <= 2),"up till now, the dimensions of tensor a and b should less than 3" return singa.__add__(a, b) def backward(self, dy): if(type(dy)==float): assert self.shape0==self.shape1,('should have same shape') return dy,dy db=CTensor(list(dy.shape()), dy.device()) db.CopyData(dy) for i in range(len(self.shape0)-len(self.shape1)): db=singa.Sum(db, 0) return dy, db ``` Can we allow input dimension to ADD more than two? (e.g. change the limit 2 to 4 or disable the assertion). Typically there are four dimensions for conv. feature maps: batch, depth/channel, width, height Or if the input shapes of the two operands are two same, it also passes: ```python assert( (len(self.shape0) <= 2 and len(self.shape1) <= 2) or (len(self.shape0)-len(self.shape1)==0) ) ---------------------------------------------------------------- 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 With regards, Apache Git Services