Unverified Commit 3d18adf1 by masahi Committed by GitHub

[Tutorial, QNN] Add tutorial for loading quantized PyTorch model (#5321)

* add pytorch tutorial code and doc stub

* add more docs

* formatting, more docs

* typo fix

* try make sphinx happy

* add performance section

* type and nit fix

* format fix
parent 09eb5082
...@@ -612,7 +612,7 @@ sequential pass example could be like the following to enable IR dumping for ...@@ -612,7 +612,7 @@ sequential pass example could be like the following to enable IR dumping for
seq = tvm.transform.Sequential([ seq = tvm.transform.Sequential([
relay.transform.InferType(), relay.transform.InferType(),
relay.transform.FoldConstant(), relay.transform.FoldConstant(),
relay.transform.PrintIR(), transform.PrintIR(),
relay.transform.EliminateCommonSubexpr(), relay.transform.EliminateCommonSubexpr(),
relay.transform.AlterOpLayout() relay.transform.AlterOpLayout()
]) ])
......
...@@ -88,8 +88,8 @@ img = np.expand_dims(img, 0) ...@@ -88,8 +88,8 @@ img = np.expand_dims(img, 0)
###################################################################### ######################################################################
# Import the graph to Relay # Import the graph to Relay
# ------------------------- # -------------------------
# Convert PyTorch graph to Relay graph. # Convert PyTorch graph to Relay graph. The input name can be arbitrary.
input_name = 'input0' # only one input, set it to this name input_name = 'input0'
shape_list = [(input_name, img.shape)] shape_list = [(input_name, img.shape)]
mod, params = relay.frontend.from_pytorch(scripted_model, mod, params = relay.frontend.from_pytorch(scripted_model,
shape_list) shape_list)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment