dhruvaray commented on a change in pull request #5447:
URL: https://github.com/apache/incubator-tvm/pull/5447#discussion_r416522950



##########
File path: python/tvm/relay/op/transform.py
##########
@@ -884,3 +884,29 @@ def unravel_index(indices, shape):
     """
 
     return _make.unravel_index(indices, shape)
+
+def sparse_to_dense(sparse_indices, sparse_values, default_value, 
output_shape):
+    """Converts a sparse representation into a dense tensor.
+       Example::
+       -   sparse_to_dense([[0, 0], [1, 1]], [3, 3], 0, [2, 2]) = [[3, 0], [0, 
3]]
+
+       Parameters
+       ----------
+       sparse_indices : tvm.te.Tensor
+           A 0-D, 1-D, or 2-D tensor of type `int32` or `int64`.
+           `sparse_indices[i]` contains the complete index where 
`sparse_values[i]` will be placed.
+       sparse_values : tvm.te.Tensor
+           A 0-D or 1-D tensor.
+           Values corresponding to each row of sparse_indices,
+           or a scalar value to be used for all sparse indices.
+       default_value : tvm.te.Tensor

Review comment:
       Fixe

##########
File path: python/tvm/relay/op/transform.py
##########
@@ -884,3 +884,29 @@ def unravel_index(indices, shape):
     """
 
     return _make.unravel_index(indices, shape)
+
+def sparse_to_dense(sparse_indices, sparse_values, default_value, 
output_shape):
+    """Converts a sparse representation into a dense tensor.
+       Example::
+       -   sparse_to_dense([[0, 0], [1, 1]], [3, 3], 0, [2, 2]) = [[3, 0], [0, 
3]]
+
+       Parameters
+       ----------
+       sparse_indices : tvm.te.Tensor
+           A 0-D, 1-D, or 2-D tensor of type `int32` or `int64`.
+           `sparse_indices[i]` contains the complete index where 
`sparse_values[i]` will be placed.
+       sparse_values : tvm.te.Tensor
+           A 0-D or 1-D tensor.
+           Values corresponding to each row of sparse_indices,
+           or a scalar value to be used for all sparse indices.
+       default_value : tvm.te.Tensor

Review comment:
       Fixed




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


Reply via email to