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

fix block.export (#17970) #19075

Merged
merged 1 commit into from
Sep 3, 2020
Merged

fix block.export (#17970) #19075

merged 1 commit into from
Sep 3, 2020

Conversation

jmracek
Copy link

@jmracek jmracek commented Sep 2, 2020

This PR cherry-picks commit 5122d32 into the v1.x branch. This is to enable the export of models where dangling layers are optimized out during symbol export. For more information, see here and here.

  • fix block.export

net.hybridize may optimize out some ops. These ops are alive in nn.Block(also nn.HybridBlock), but its names are not contained in symbol's arg_names list. So ignore these ops except that their name are end with 'running_mean' or 'running_var'.

  • Update block.py

let user can save their extra param.

  • add allow_extra

add allow_extra to let user decide whether to save extra parameters or not.

  • Update block.py

add moving_mean and moving_var when export model with SymbolBlock

  • Update python/mxnet/gluon/block.py

typo

Co-authored-by: Sheng Zha szha@users.noreply.github.com

  • Update block.py

  • Update block.py

  • Update python/mxnet/gluon/block.py

Co-authored-by: Leonard Lausen leonard@lausen.nl

Co-authored-by: Sheng Zha szha@users.noreply.github.com
Co-authored-by: Leonard Lausen leonard@lausen.nl

Description

(Brief description on what this PR is about)

Checklist

Essentials

  • PR's title starts with a category (e.g. [BUGFIX], [MODEL], [TUTORIAL], [FEATURE], [DOC], etc)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage
  • Code is well-documented

Changes

  • Feature1, tests, (and when applicable, API doc)
  • Feature2, tests, (and when applicable, API doc)

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here

* fix block.export

```net.hybridize``` may optimize out some ops. These ops are alive in nn.Block(also nn.HybridBlock), but its names are not contained in symbol's ```arg_names``` list. So ignore these ops except that their name are end with 'running_mean' or 'running_var'.

* Update block.py

let user can save their extra param.

* add allow_extra

add allow_extra to let user decide whether to save extra parameters or not.

* Update block.py

add moving_mean and moving_var when export model with SymbolBlock

* Update python/mxnet/gluon/block.py

typo

Co-authored-by: Sheng Zha <szha@users.noreply.github.com>

* Update block.py

* Update block.py

* Update python/mxnet/gluon/block.py

Co-authored-by: Leonard Lausen <leonard@lausen.nl>

Co-authored-by: Sheng Zha <szha@users.noreply.github.com>
Co-authored-by: Leonard Lausen <leonard@lausen.nl>
@jmracek jmracek requested a review from szha as a code owner September 2, 2020 20:29
@mxnet-bot
Copy link

Hey @jmracek , Thanks for submitting the PR
All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands:

  • To trigger all jobs: @mxnet-bot run ci [all]
  • To trigger specific jobs: @mxnet-bot run ci [job1, job2]

CI supported jobs: [miscellaneous, website, clang, edge, windows-gpu, windows-cpu, centos-cpu, sanity, unix-gpu, unix-cpu, centos-gpu]


Note:
Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin.
All CI tests must pass before the PR can be merged.

Copy link
Member

@szha szha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the backport!

@leezu leezu merged commit 748eebd into apache:v1.x Sep 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants