merrymercy commented on a change in pull request #7635:
URL: https://github.com/apache/tvm/pull/7635#discussion_r602000314



##########
File path: tutorials/auto_scheduler/tune_network_arm.py
##########
@@ -127,6 +132,23 @@ def get_network(name, batch_size, layout="NHWC", 
dtype="float32"):
             net.params, relay.nn.softmax(net.body), None, net.type_params, 
net.attrs
         )
         mod = tvm.IRModule.from_expr(net)
+    elif name == "mlp":
+        mod, params = relay.testing.mlp.get_workload(
+            batch_size=batch_size, dtype=dtype, image_shape=image_shape, 
num_classes=1000
+        )
+    else:
+        raise ValueError("Network not found.")
+
+    if use_sparse:
+        bs_r = 1
+        bs_c = 1
+        sparsity = 0.85
+        mod, params = ddo.simplify_fc_transpose.convert(mod["main"], params)
+        # This is a test workload that manually transforms a dense model to 
sparse
+        params = random_sparse_dense_params(mod, params, bs_r=bs_r, bs_c=bs_c, 
density=1 - sparsity)
+        # Currently we only support to conver dense matmul to sparse dense 
matmul
+        mod, params = ddo.bsr_dense.convert(mod, params, (bs_r, bs_c), 
sparsity_threshold=0.8)
+        mod = tvm.IRModule.from_expr(mod)

Review comment:
       I see. The sparse part is not the focus of this tutorial, so we should 
not put too much code here and let them confuse the readers.
   I suggest adding a one-line wrapper like
   ```mod, params = convert_to_block_sparse(bs_r=1, bs_c=1, sparsity=0.85)```




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