Skip to content

Commit

Permalink
add filter to warnings (apache#14532)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasDelteil authored and vdantu committed Mar 31, 2019
1 parent 4c9286a commit c9b0507
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/tutorials/gluon/hybrid.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ to gluon with `SymbolBlock`:
import warnings

with warnings.catch_warnings():
warnings.simplefilter("ignore")
net2 = gluon.SymbolBlock.imports('model-symbol.json', ['data'], 'model-0001.params')
```

Expand Down
1 change: 1 addition & 0 deletions docs/tutorials/gluon/save_load_params.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ Serialized Hybrid networks (saved as .JSON and .params file) can be loaded and u
```python
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
deserialized_net = gluon.nn.SymbolBlock.imports("lenet-symbol.json", ['data'], "lenet-0001.params", ctx=ctx)
```

Expand Down
1 change: 1 addition & 0 deletions docs/tutorials/onnx/fine_tuning_gluon.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ We create a symbol block that is going to hold all our pre-trained layers, and a
```python
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
pre_trained = gluon.nn.SymbolBlock(outputs=new_sym, inputs=mx.sym.var('data_0'))
net_params = pre_trained.collect_params()
for param in new_arg_params:
Expand Down
1 change: 1 addition & 0 deletions docs/tutorials/onnx/inference_on_onnx_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ And load them into a MXNet Gluon symbol block.
```python
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
net = gluon.nn.SymbolBlock(outputs=sym, inputs=mx.sym.var('data_0'))
net_params = net.collect_params()
for param in arg_params:
Expand Down
5 changes: 4 additions & 1 deletion docs/tutorials/python/module_to_gluon.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,10 @@ print("Output probabilities: {}".format(prob))
For the Gluon API, it is a lot simpler. You can just load a serialized model in a [`SymbolBlock`](https://mxnet.incubator.apache.org/api/python/gluon/gluon.html?highlight=symbolblo#mxnet.gluon.SymbolBlock) and run inference directly.

```python
net = gluon.SymbolBlock.imports('module-model-symbol.json', ['data', 'softmax_label'], 'module-model-0005.params')
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
net = gluon.SymbolBlock.imports('module-model-symbol.json', ['data', 'softmax_label'], 'module-model-0005.params')
prob = net(mx.nd.ones((1,1,28,28)), mx.nd.ones(1)) # note the second argument here to account for the softmax_label symbol
print("Output probabilities: {}".format(prob.asnumpy()))
```
Expand Down

0 comments on commit c9b0507

Please sign in to comment.