hzfan commented on a change in pull request #5121: [TE] reverse-mode autodiff 
without any optimization
URL: https://github.com/apache/incubator-tvm/pull/5121#discussion_r396631729
 
 

 ##########
 File path: python/tvm/te/autodiff.py
 ##########
 @@ -0,0 +1,72 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""
+Automatic differentiation of tensor expressions.
+The algorithm was initially implemented by Sergei Grechanik (sgrechanik-h)
+in [Automatic differentiation for tensor expressions](#2498)
+and [Zero elimination](#2634)
+"""
+from . import _ffi_api
+
+
+def gradient(output, inputs, head=None):
+    """Perform reverse-mode automatic differentiation.
+
+    Parameters
+    ----------
+    output : Tensor
+        The tensor to differentiate.
+
+    inputs : List[Tensor]
+        The list of input tensors to be differentiated wrt.
+
+    head : Tensor
+        The adjoint of the output, in other words, some tensor, by which the 
Jacobians
+        will be multiplied. Its shape must be of the form `prefix + 
output.shape`.
+        If `None` is passed, the identity tensor of shape `output.shape + 
output.shape`
 
 Review comment:
   So the default behavior is to return a Jacobian instead of adjoint, right?

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