You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/10/22 05:50:43 UTC

[GitHub] [tvm] AndrewZhaoLuo commented on a change in pull request #9329: [Relay/TOPI][ONNX/TFLite] Refactor MATRIX_SET_DIAG Operator for Relay…

AndrewZhaoLuo commented on a change in pull request #9329:
URL: https://github.com/apache/tvm/pull/9329#discussion_r734250090



##########
File path: python/tvm/relay/frontend/onnx.py
##########
@@ -4226,6 +4226,35 @@ def _impl_v1(cls, inputs, attr, params):
         return _expr.TupleWrapper(_expr.Tuple(result), len(result))
 
 
+class Trilu(OnnxOpConverter):
+    """Operator converter for Trilu"""
+    
+    @classmethod
+    def _impl_v1(cls, inputs, attr, params):

Review comment:
       this should be opset14 so _impl_v14

##########
File path: python/tvm/relay/frontend/onnx.py
##########
@@ -4226,6 +4226,35 @@ def _impl_v1(cls, inputs, attr, params):
         return _expr.TupleWrapper(_expr.Tuple(result), len(result))
 
 
+class Trilu(OnnxOpConverter):
+    """Operator converter for Trilu"""
+    
+    @classmethod
+    def _impl_v1(cls, inputs, attr, params):
+        upper = attr.get("upper")

Review comment:
       suggest attr.get("upper", 1) since this appears to be the default

##########
File path: include/tvm/topi/transform.h
##########
@@ -1776,12 +1775,10 @@ inline Tensor matrix_set_diag(const Tensor& input, const Tensor& diagonal, int k
           for (size_t i = 0; i < ndim - 1; i++) {
             diagonal_indices.push_back(iter_vars[i]);
           }
-          if (only_one_diagonal) {
-            k = k1;
-          } else {
+          auto multi_diagonals = [&]() {
             // Determining which diagonal/sub-diagonal/super-diagonal it is
             k = iter_vars[ndim] - iter_vars[ndim - 1];
-            diagonal_indices.push_back(k2 - k);
+            diagonal_indices.push_back(k2(0) - k);

Review comment:
       I believe (though please check) that you can just do k2() for 0-D tensor access.




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

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org