tkonolige commented on a change in pull request #7107:
URL: https://github.com/apache/tvm/pull/7107#discussion_r542582066



##########
File path: tutorials/frontend/deploy_sparse.py
##########
@@ -314,13 +310,20 @@ def run_sparse(mod, params, shape_dict, target, ctx, 
bs_r, sparsity, gen_weights
 # you'll need to uncomment the last line first.
 def benchmark():
     mod, params, shape_dict = import_graphdef(name, batch_size, seq_len)
-    run_dense(mod, params, shape_dict, target, ctx)
+    input_shape = shape_dict["input_1"]
+    dummy_data = np.random.uniform(size=input_shape, low=0, 
high=input_shape[1]).astype("int32")
+    dense_output = run_dense(mod, params, shape_dict, target, ctx, dummy_data)
     if measure_sparse:
         gen_weights = "prune" not in name
-        run_sparse(mod, params, shape_dict, target, ctx, bs_r, sparsity, 
gen_weights)
+        sparse_output = run_sparse(
+            mod, params, shape_dict, target, ctx, bs_r, sparsity, gen_weights, 
dummy_data
+        )
+        np.testing.assert_allclose(
+            dense_output, sparse_output, equal_nan=True, verbose=True, 
atol=1e-5, rtol=1e-5
+        )
 
 
-# benchmark()
+benchmark()

Review comment:
       This should remain commented out so we don't spend our CI time on 
benchmarking.




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