Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Gluon export changing params #19354

@samskalicky

Description

@samskalicky

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions