Skip to content

Commit d5b2275

Browse files
authored
update the outdated functions (#55)
* update the outdated functions * update outdated functions
1 parent 4f248c8 commit d5b2275

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

chapter_getting_started/from_mxnet.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ You can view `mod` as a TVM module we already seen in :numref:`ch_vector_add`.
9191
Now we can create a runtime to run the model inference, namely the forward pass of a neural network. Creating the runtime needs the neural network definition in json (i.e. `graph`) and the library that contains machine code of compiled operators (i.e. `mod`), with a device context that can be constructed from the target. The device is CPU here, specified by `llvm`. Next we load the parameters with `set_input` and run the workload by feeding the input data. Since this network has a single output layer, we can obtain it, a `(1, 1000)` shape matrix, by `get_output(0)`. The final output is a 1000-length NumPy vector.
9292

9393
```{.python .input n=9}
94-
ctx = tvm.context(target)
95-
rt = tvm.contrib.graph_runtime.create(graph, mod, ctx)
94+
ctx = tvm.device(target)
95+
rt = tvm.contrib.graph_executor.create(graph, mod, ctx)
9696
rt.set_input(**params)
9797
rt.run(data=tvm.nd.array(x))
9898
scores = rt.get_output(0).asnumpy()[0]
@@ -135,11 +135,11 @@ loaded_params = open(params_fn, "rb").read()
135135
And then construct the runtime as before to verify the results
136136

137137
```{.python .input n=13}
138-
loaded_rt = tvm.contrib.graph_runtime.create(loaded_graph, loaded_mod, ctx)
138+
loaded_rt = tvm.contrib.graph_executor.create(loaded_graph, loaded_mod, ctx)
139139
loaded_rt.load_params(loaded_params)
140140
loaded_rt.run(data=tvm.nd.array(x))
141141
loaded_scores = loaded_rt.get_output(0).asnumpy()[0]
142-
tvm.testing.assert_allclose(loaded_scores, scores)
142+
np.testing.assert_allclose(loaded_scores, scores)
143143
```
144144

145145
## Summary

0 commit comments

Comments
 (0)