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 2022/04/01 18:13:18 UTC

[GitHub] [tvm] bfgoldstein opened a new pull request #10873: [Relay/TOPI][ONNX/TFLite] Refactor MATRIX_SET_DIAG Operator for Relay/TOPI to support ONNX Trilu operator

bfgoldstein opened a new pull request #10873:
URL: https://github.com/apache/tvm/pull/10873


   This commit is based on PR #9329 proposed by @shengxinhu.
   
   Refactor MATRIX_SET_DIAG operator in Relay/TOPI to support ONNX Trilu operator;
       + Fixed issues related to shape transformation of inputs in TFLite and ONNX frontend ops.
   
   @AndrewZhaoLuo PTAL


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



[GitHub] [tvm] jwfromm commented on a change in pull request #10873: [Relay/TOPI][ONNX/TFLite] Refactor MATRIX_SET_DIAG Operator for Relay/TOPI to support ONNX Trilu operator

Posted by GitBox <gi...@apache.org>.
jwfromm commented on a change in pull request #10873:
URL: https://github.com/apache/tvm/pull/10873#discussion_r840926853



##########
File path: src/relay/op/tensor/transform.cc
##########
@@ -3880,9 +3866,11 @@ RELAY_REGISTER_OP("matrix_set_diag")
         **sub_diag_right_align** Bool, true iff sub-diagonal is right aligned (left-padded).
     )code" TVM_ADD_FILELINE)
     .set_attrs_type<MatrixSetDiagAttrs>()
-    .set_num_inputs(2)
+    .set_num_inputs(4)
     .add_argument("input", "Tensor", "Input Tensor.")
     .add_argument("diagonal", "Tensor", "Values to be filled in the diagonal.")
+    .add_argument("k1", "Tensor", "ILower limit (included) of the range of diagonals.")

Review comment:
       Small typo here "ILower" -> "Lower"

##########
File path: tests/python/topi/python/test_topi_transform.py
##########
@@ -1240,9 +1257,6 @@ def test_sparse_to_dense():
 @tvm.testing.uses_gpu
 def test_matrix_set_diag():
     for dtype in ["float32", "int32"]:
-        verify_matrix_set_diag((2, 2), (2,), dtype)
-        verify_matrix_set_diag((4, 3, 3), (4, 3), dtype)
-        verify_matrix_set_diag((2, 3, 4), (2, 3), dtype, 1)

Review comment:
       Just curious, why are these tests removed?

##########
File path: tests/python/topi/python/test_topi_transform.py
##########
@@ -752,21 +752,38 @@ def check_device(target, dev):
 def verify_matrix_set_diag(input_shape, diagonal_shape, dtype, k=0, align="RIGHT_LEFT"):
     input = te.placeholder(shape=input_shape, name="input", dtype=dtype)
     diagonal = te.placeholder(shape=diagonal_shape, name="diagonal", dtype=dtype)
-    matrix_set_diag_result = topi.transform.matrix_set_diag(input, diagonal, k, align)
+    k1 = te.placeholder(shape=(1,), name="k1", dtype="int64")
+    k2 = te.placeholder(shape=(1,), name="k2", dtype="int64")
+    matrix_set_diag_result = topi.transform.matrix_set_diag(input, diagonal, (k1, k2), align)
+
+    k_one, k_two = None, None
+    if isinstance(k, (tuple, list)):

Review comment:
       Can you add some comments to this test? It's a little hard to follow.




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