singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [singa] nudles commented on a change in pull request #570: Tensor naming convention review
Date Wed, 01 Jan 2020 07:32:24 GMT
nudles commented on a change in pull request #570: Tensor naming convention review
URL: https://github.com/apache/singa/pull/570#discussion_r362307562
 
 

 ##########
 File path: python/singa/tensor.py
 ##########
 @@ -352,74 +356,86 @@ def deepcopy(self):
         '''
         return self.clone()
 
-    def bernoulli(self, p):
+    def bernoulli(self, p, inplace=True):
         '''Sample 0/1 for each element according to the given probability.
 
         Args:
             p (float): with probability p, each element is sample to 1.
         '''
+        if not inplace:
+            # return new tensor
+            raise NotImplementedError
+
         singa.Bernoulli(float(p), self.data)
 
-    def gaussian(self, mean, std):
+    def gaussian(self, mean, std, inplace=True):
         '''Generate a value for each element following a Gaussian distribution.
 
         Args:
             mean (float): mean of the distribution
             std (float): standard variance of the distribution
         '''
+        if not inplace:
+            # return new tensor
+            raise NotImplementedError
+
         singa.Gaussian(float(mean), float(std), self.data)
 
-    def uniform(self, low, high):
+    def uniform(self, low, high, inplace=True):
         '''Generate a value for each element following a uniform distribution.
 
         Args:
             low (float): the lower bound
             high (float): the hight bound
         '''
+        if not inplace:
+            # return new tensor
+            raise NotImplementedError
+
         singa.Uniform(float(low), float(high), self.data)
 
     def add_column(self, v):
 
 Review comment:
   print the the new function name in the msg.

----------------------------------------------------------------
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

Mime
View raw message