samskalicky edited a comment on issue #19354:
URL: 
https://github.com/apache/incubator-mxnet/issues/19354#issuecomment-708849369


   It further compounds in Gluon where creating the new Parameter doesnt set 
the dtype explicitly:
   
https://github.com/apache/incubator-mxnet/blob/6729cf3bf4edd6837b0feb6417691ce2e00dbcee/python/mxnet/gluon/block.py#L1002-L1003
   This leads to the default dtype `mx_real_t` which is float32:
   
https://github.com/apache/incubator-mxnet/blob/ce1e68260eb3cf9219ae4d59df8bdde7361802ec/python/mxnet/gluon/parameter.py#L106
   with this error:
   ```
   Traceback (most recent call last):
     File "test_subgraph.py", line 155, in <module>
       test("myProp")
     File "test_subgraph.py", line 113, in test
       clear=False, backend_opts={'dedup_subgraph':True})
     File "/home/ubuntu/incubator-mxnet/python/mxnet/gluon/block.py", line 
1119, in optimize_for
       self._build_cache(x, *args)
     File "/home/ubuntu/incubator-mxnet/python/mxnet/gluon/block.py", line 
1003, in _build_cache
       param._load_init(param_data, args[0].context)
     File "/home/ubuntu/incubator-mxnet/python/mxnet/gluon/parameter.py", line 
302, in _load_init
       self.name, str(self.dtype), str(data.dtype))
   AssertionError: Failed loading Parameter '_op0_input' from saved params: 
dtype incompatible expected <class 'numpy.float32'> vs saved <class 
'numpy.float16'>. Set cast_dtype=True to cast the dtype of saved params.
   ```


----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to