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/10 18:42:28 UTC

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

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



##########
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:
       Checking the rank of sparse_indices, sparse_values and default value should be an external error, not an internal error. You should use CHECK instead of ICHECK




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