codeislife99 commented on a change in pull request #7442:
URL: https://github.com/apache/tvm/pull/7442#discussion_r576393102
##########
File path: tests/python/frontend/tensorflow/test_forward.py
##########
@@ -1812,6 +1812,109 @@ def test_forward_sparse_dense_matmul():
)
+#######################################################################
+# SparseFillEmptyRows
+# ------------
+
+
+def _test_sparse_fill_empty_rows(indices_np, values_np, dense_shape_np,
default_value_int, use_dyn):
+ with tf.Graph().as_default():
+ if use_dyn:
+ indices = tf.placeholder(shape=(None, None),
dtype=indices_np.dtype, name="indices")
+ values = tf.placeholder(shape=(None), dtype=values_np.dtype,
name="values")
+ dense_shape = tf.placeholder(
+ shape=(None), dtype=dense_shape_np.dtype, name="dense_shape"
+ )
+ else:
+ indices = tf.placeholder(shape=indices_np.shape,
dtype=indices_np.dtype, name="indices")
+ values = tf.placeholder(shape=values_np.shape,
dtype=values_np.dtype, name="values")
+ dense_shape = tf.placeholder(
+ shape=dense_shape_np.shape, dtype=dense_shape_np.dtype,
name="dense_shape"
+ )
+
+ default_value = tf.placeholder(shape=(), dtype=values_np.dtype,
name="default_value")
+ sp_input = tf.sparse.SparseTensor(indices=indices, values=values,
dense_shape=dense_shape)
+ _ = tf.sparse.fill_empty_rows(sp_input, default_value,
name="sparse_fill_empty_rows")
+ compare_tf_with_tvm(
+ [indices_np, values_np, dense_shape_np, default_value_int],
+ [indices.name, values.name, dense_shape.name, default_value.name],
+ [
+ "sparse_fill_empty_rows/SparseFillEmptyRows:0",
+ "sparse_fill_empty_rows/SparseFillEmptyRows:1",
+ "sparse_fill_empty_rows/SparseFillEmptyRows:2",
+ ],
+ mode="vm",
+ )
+
+
[email protected](
+ "sparse_indices_np, sparse_values_np, dense_shape_np, default_value_int",
+ [
+ (
+ np.array([[1, 1], [0, 3], [0, 1], [2, 0], [3, 1]], dtype=np.int64),
Review comment:
So this is a valid test case.
----------------------------------------------------------------
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]