samskalicky opened a new issue #19354:
URL: https://github.com/apache/incubator-mxnet/issues/19354


   ## Description
   When exporting a model from Gluon, some param values can be modified:
   
https://github.com/apache/incubator-mxnet/blob/ce1e68260eb3cf9219ae4d59df8bdde7361802ec/python/mxnet/gluon/block.py#L1354
   The `_reduce` function here actually performs a sum/division:
   
https://github.com/apache/incubator-mxnet/blob/ce1e68260eb3cf9219ae4d59df8bdde7361802ec/python/mxnet/gluon/parameter.py#L406
   
   If the data type is floating point, then the resulting [IEEE FP standard 
calls for a rounding 
operation](https://en.wikipedia.org/wiki/Floating-point_arithmetic#Representable_numbers,_conversion_and_rounding).
 Even though summing by 1 and dividing by 1 should result in the same value, it 
may be slightly altered. 
   
   If specific binary data is encoded within a param, then this operation will 
modify that data and cause corruption. 
   
   ### Possible solution
   I propose checking the length of the block, and if it is 1 then skipping the 
sum/divide operation. 


----------------------------------------------------------------
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