nudles commented on a change in pull request #645: add function comments for 
autograd
URL: https://github.com/apache/singa/pull/645#discussion_r402065536
 
 

 ##########
 File path: python/singa/autograd.py
 ##########
 @@ -697,15 +833,32 @@ def backward(self, dy):
 
 
 def prelu(x, slope):
+    """
+    PRelu applies the function f(x) = slope * x for x < 0, f(x) = x for x >= 0 
to the data tensor elementwise.
+    Args:
+        x: matrix.
+    Return:
+        the result Tensor
+    """
     return PRelu()(x, slope)[0]
 
 
 class Add(Operation):
+    """
+    Performs element-wise binary addition.
+    """
 
     def __init__(self):
         super(Add, self).__init__()
 
     def forward(self, a, b):
+        """
+        Args:
+            a (CTensor): First operand..
 
 Review comment:
   For simple functions, we can simplify the docstring, e.g., no need to use 
"First operand.." or "Second operand". You can put "Return a+b, where a and b 
are CTensor."
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to