You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2020/08/02 23:45:29 UTC
[GitHub] [incubator-mxnet] szha opened a new issue #18843: casting Gluon block doesn't work for export
szha opened a new issue #18843:
URL: https://github.com/apache/incubator-mxnet/issues/18843
## Description
casting Gluon block doesn't work for export. the exported data type remains the same as before the cast.
## To Reproduce
```python
import mxnet as mx
net_fp32 = mx.gluon.model_zoo.vision.resnet34_v2(pretrained=False)
net_fp32.initialize()
net_fp32(mx.nd.zeros((1,3,224,224)))
net_fp32.cast('float64')
net_fp32.hybridize()
data = mx.nd.zeros((1,3,224,224), dtype='float64')
net_fp32(data)
sym_file, params_file = net_fp32.export('test', 0)
sm = mx.sym.load(sym_file)
inputs = mx.sym.var('data', dtype='float64')
net_fp64 = mx.gluon.SymbolBlock(sm, inputs)
net_fp64.load_parameters(params_file)
```
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [incubator-mxnet] szha commented on issue #18843: casting Gluon block doesn't work for export
Posted by GitBox <gi...@apache.org>.
szha commented on issue #18843:
URL: https://github.com/apache/incubator-mxnet/issues/18843#issuecomment-667744248
This works:
```python
import mxnet as mx
net_fp32 = mx.gluon.model_zoo.vision.resnet34_v2(pretrained=True)
net_fp32.cast('float64')
net_fp32.hybridize()
data = mx.nd.zeros((1,3,224,224), dtype='float64')
net_fp32(data)
sym_file, params_file = net_fp32.export('test', 0)
sm = mx.sym.load(sym_file)
inputs = mx.sym.var('data', dtype='float64')
net_fp64 = mx.gluon.SymbolBlock(sm, inputs)
net_fp64.load_parameters(params_file)
```
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [incubator-mxnet] leezu edited a comment on issue #18843: casting Gluon block doesn't work for export
Posted by GitBox <gi...@apache.org>.
leezu edited a comment on issue #18843:
URL: https://github.com/apache/incubator-mxnet/issues/18843#issuecomment-668161817
The issue is due to the symbol (and thus it's `json` representation) not being updated after the cast:
```
% diff test-symbol.json test2-symbol.json ~ ip-172-31-95-96
13c13
< "__dtype__": "0",
---
> "__dtype__": "1",
16,17c16,17
< "__profiler_scope__": "<unk>:",
< "__shape__": "(0,)",
---
> "__profiler_scope__": "hybridsequential0:",
> "__shape__": "(3,)",
27c27
< "__dtype__": "0",
---
> "__dtype__": "1",
30,31c30,31
< "__profiler_scope__": "<unk>:",
< "__shape__": "(0,)",
---
> "__profiler_scope__": "hybridsequential0:",
> "__shape__": "(3,)",
41c41
< "__dtype__": "0",
---
> "__dtype__": "1",
44,45c44,45
< "__profiler_scope__": "<unk>:",
< "__shape__": "(0,)",
---
> "__profiler_scope__": "hybridsequential0:",
> "__shape__": "(3,)",
55c55
< "__dtype__": "0",
---
> "__dtype__": "1",
[...]
```
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [incubator-mxnet] leezu commented on issue #18843: casting Gluon block doesn't work for export
Posted by GitBox <gi...@apache.org>.
leezu commented on issue #18843:
URL: https://github.com/apache/incubator-mxnet/issues/18843#issuecomment-668161817
The issue is due to the symbol (and thus it's `json` representation) not being updated after the export:
```
% diff test-symbol.json test2-symbol.json ~ ip-172-31-95-96
13c13
< "__dtype__": "0",
---
> "__dtype__": "1",
16,17c16,17
< "__profiler_scope__": "<unk>:",
< "__shape__": "(0,)",
---
> "__profiler_scope__": "hybridsequential0:",
> "__shape__": "(3,)",
27c27
< "__dtype__": "0",
---
> "__dtype__": "1",
30,31c30,31
< "__profiler_scope__": "<unk>:",
< "__shape__": "(0,)",
---
> "__profiler_scope__": "hybridsequential0:",
> "__shape__": "(3,)",
41c41
< "__dtype__": "0",
---
> "__dtype__": "1",
44,45c44,45
< "__profiler_scope__": "<unk>:",
< "__shape__": "(0,)",
---
> "__profiler_scope__": "hybridsequential0:",
> "__shape__": "(3,)",
55c55
< "__dtype__": "0",
---
> "__dtype__": "1",
[...]
```
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [incubator-mxnet] szha closed issue #18843: casting Gluon block doesn't work for export
Posted by GitBox <gi...@apache.org>.
szha closed issue #18843:
URL: https://github.com/apache/incubator-mxnet/issues/18843
----------------------------------------------------------------
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:
users@infra.apache.org