Hi there.
I try to build a server that can handle pre-trained models and run scheduled predictions on them.
As described in tutorial, I use sym, arg_params, aux_params = mx.model.load_checkpoint('resnet-152', 0)
to parse a symbolic description of the net. But I also need a type and shape information of the model input and output.
- How do I determine inputs/outputs of the model? In Tensorflow I can use Signatures in MetaGraphDef, does MXNET support anything similar?
- When I get inputs/outputs names, how can I get their types and shapes? My current guess is to use
Symbol.infer_shape
andSymbol.infer_type
methods. But for current.minimal code snipped I get strange error
import mxnet as mx
path='http://data.mxnet.io/models/imagenet-11k/'
[mx.test_utils.download(path+'resnet-152/resnet-152-symbol.json'),
mx.test_utils.download(path+'resnet-152/resnet-152-0000.params'),
mx.test_utils.download(path+'synset.txt')]
sym, arg_params, aux_params = mx.model.load_checkpoint('resnet-152', 0)
sym.infer_shape()
MXNetError: Error in operator bn_data: [14:04:58] src/operator/batch_norm-inl.h:238: Check failed: channelAxis < dshape.ndim() (1 vs. 0) Channel axis out of range: 1
Stack trace returned 10 entries:
[bt] (0) 0 libmxnet.so 0x00000001115baad8 _ZN4dmlc15LogMessageFatalD2Ev + 40
[bt] (1) 1 libmxnet.so 0x0000000111e1f620 _ZNK5mxnet2op13BatchNormProp10InferShapeEPNSt3__16vectorIN4nnvm6TShapeENS2_9allocatorIS5_EEEES9_S9_ + 1968
[bt] (2) 2 libmxnet.so 0x0000000111dfe97e _ZN5mxnet2op16OpPropInferShapeERKN4nnvm9NodeAttrsEPNSt3__16vectorINS1_6TShapeENS5_9allocatorIS7_EEEESB_ + 878
[bt] (3) 3 libmxnet.so 0x00000001126359aa _ZZN4nnvm4pass12_GLOBAL__N_19InferAttrINS_6TShapeEZNKS1_3$_0clENS_5GraphEEUlRKS3_E_DnEES5_OS5_T_PKcSC_SC_SC_SC_T0_T1_ENKUljbE_clEjb + 2250
[bt] (4) 4 libmxnet.so 0x000000011263437a _ZNSt3__110__function6__funcIN4nnvm4pass12_GLOBAL__N_13$_0ENS_9allocatorIS5_EEFNS2_5GraphES8_EEclEOS8_ + 3178
[bt] (5) 5 libmxnet.so 0x000000011261e6ab _ZN4nnvm11ApplyPassesENS_5GraphERKNSt3__16vectorINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS6_IS8_EEEE + 795
[bt] (6) 6 libmxnet.so 0x0000000111cc88bb _ZN4nnvm9ApplyPassENS_5GraphERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 187
[bt] (7) 7 libmxnet.so 0x0000000111ccc14b _ZN4nnvm4pass10InferShapeENS_5GraphENSt3__16vectorINS_6TShapeENS2_9allocatorIS4_EEEENS2_12basic_stringIcNS2_11char_traitsIcEENS5_IcEEEE + 891
[bt] (8) 8 libmxnet.so 0x0000000111cc9f96 MXSymbolInferShape + 2534
[bt] (9) 9 libffi.6.dylib 0x00000001107d8884 ffi_call_unix64 + 76
Thanks in advance