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 2020/11/11 05:38:12 UTC

[GitHub] [incubator-tvm] lixiaoquan commented on a change in pull request #6892: [Relay] Add dynamic SparseToDense

lixiaoquan commented on a change in pull request #6892:
URL: https://github.com/apache/incubator-tvm/pull/6892#discussion_r521123874



##########
File path: src/relay/op/dyn/tensor/transform.cc
##########
@@ -556,6 +556,77 @@ Examples::
     .set_attr<TOpPattern>("TOpPattern", kInjective)
     .set_attr<AnyCodegenStrategy>("AnyCodegenStrategy", kVariableDimensions);
 
+bool SparseToDenseRel(const Array<Type>& types, int num_inputs, const Attrs& attrs,
+                      const TypeReporter& reporter) {
+  ICHECK_EQ(num_inputs, 4);
+  auto sparse_indices = types[0].as<TensorTypeNode>();
+  auto sparse_values = types[1].as<TensorTypeNode>();
+  auto default_value = types[2].as<TensorTypeNode>();
+  auto output_shape = types[3].as<TensorTypeNode>();
+
+  if (sparse_indices == nullptr || sparse_values == nullptr || default_value == nullptr ||
+      output_shape == nullptr) {
+    return false;
+  }
+
+  ICHECK(sparse_indices->dtype.is_int()) << "sparse_indices must be tensor of integers";
+
+  ICHECK_LE(sparse_indices->shape.size(), 3)

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:
users@infra.apache.org