[GitHub] [incubator-singa] nudles commented on a change in pull request #517: SINGA-474 squeeze operator

2019-08-15 Thread GitBox
nudles commented on a change in pull request #517: SINGA-474 squeeze operator
URL: https://github.com/apache/incubator-singa/pull/517#discussion_r314186001
 
 

 ##
 File path: python/singa/autograd.py
 ##
 @@ -2194,6 +2194,30 @@ def log(x):
 return Log()(x)[0]
 
 
+class Squeeze(Operation):
+def __init__(self,axis=[]):
+super(Squeeze, self).__init__()
+self.axis=axis
+
+def forward(self, x):
+self.cache=x.shape()
+cur = list(self.cache)
 
 Review comment:
   ```
   newshape = []
   for i in self.axis:
  assert i < len(self.cache)
  assert self.cache[i] == 1, "the length of axis {} is {}, which should be 
1".format(i, self.cache[i])
   for d in self.cache:
  if d > 1:
 newshape.append(d)
   ```
   


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-singa] nudles commented on a change in pull request #517: SINGA-474 squeeze operator

2019-08-15 Thread GitBox
nudles commented on a change in pull request #517: SINGA-474 squeeze operator
URL: https://github.com/apache/incubator-singa/pull/517#discussion_r314186001
 
 

 ##
 File path: python/singa/autograd.py
 ##
 @@ -2194,6 +2194,30 @@ def log(x):
 return Log()(x)[0]
 
 
+class Squeeze(Operation):
+def __init__(self,axis=[]):
+super(Squeeze, self).__init__()
+self.axis=axis
+
+def forward(self, x):
+self.cache=x.shape()
+cur = list(self.cache)
 
 Review comment:
   ```
   newshape = []
   for i in self.axis:
  assert self.cache[i] == 1, "the length of axis {} is {}, which should be 
1".format(i, self.cache[i])
   for d in self.cache:
  if d > 1:
 newshape.append(d)
   ```
   


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:
us...@infra.apache.org


With regards,
Apache Git Services