You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@singa.apache.org by wa...@apache.org on 2019/09/20 03:05:04 UTC
[incubator-singa] branch master updated: fixed operation add
assertion for convolution
This is an automated email from the ASF dual-hosted git repository.
wangwei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-singa.git
The following commit(s) were added to refs/heads/master by this push:
new 9123155 fixed operation add assertion for convolution
new 7530b44 Merge pull request #533 from dcslin/add-fix-tensor-assert
9123155 is described below
commit 9123155092b5d5970bfdd31caf8d0dcd76a987de
Author: dcslin <13...@users.noreply.github.com>
AuthorDate: Tue Sep 10 07:44:52 2019 +0000
fixed operation add assertion for convolution
---
python/singa/autograd.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/python/singa/autograd.py b/python/singa/autograd.py
index ecfcaf5..2ad222e 100644
--- a/python/singa/autograd.py
+++ b/python/singa/autograd.py
@@ -645,7 +645,10 @@ class Add(Operation):
#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"
+
+ # fix for convolution, tensor has 4 dims
+ assert( (len(self.shape0) <= 2 and len(self.shape1) <= 2) or (self.shape0 == self.shape1) ),"up till now, the dimensions of tensor a and b should less than 3"
+
return singa.__add__(a, b)
def backward(self, dy):