thomelane commented on a change in pull request #15365: [TUTORIAL] Revise Naming tutorial URL: https://github.com/apache/incubator-mxnet/pull/15365#discussion_r297438807
########## File path: docs/tutorials/gluon/naming.md ########## @@ -174,41 +142,17 @@ with net.name_scope(): print(net.prefix, net[0].prefix, net[1].prefix) ``` - sequential1_ sequential1_alexnet0_ sequential1_alexnet1_ - - -## Saving and loading - -Because model0 and model1 have different prefixes, their parameters also have different names: +## Saving and loading of parameters +Because `model0` and `model1` have different prefixes, their parameters also have different names: ```python print(model0.collect_params(), '\n') print(model1.collect_params()) ``` - model0_ ( - Parameter model0_dense0_weight (shape=(20L, 20L), dtype=<type 'numpy.float32'>) - Parameter model0_dense0_bias (shape=(20L,), dtype=<type 'numpy.float32'>) - Parameter model0_dense1_weight (shape=(20L, 20L), dtype=<type 'numpy.float32'>) - Parameter model0_dense1_bias (shape=(20L,), dtype=<type 'numpy.float32'>) - Parameter model0_mydense_weight (shape=(20L, 20L), dtype=<type 'numpy.float32'>) - Parameter model0_mydense_bias (shape=(20L,), dtype=<type 'numpy.float32'>) - ) - - model1_ ( - Parameter model1_dense0_weight (shape=(20, 0), dtype=<type 'numpy.float32'>) - Parameter model1_dense0_bias (shape=(20,), dtype=<type 'numpy.float32'>) - Parameter model1_dense1_weight (shape=(20, 0), dtype=<type 'numpy.float32'>) - Parameter model1_dense1_bias (shape=(20,), dtype=<type 'numpy.float32'>) - Parameter model1_mydense_weight (shape=(20, 0), dtype=<type 'numpy.float32'>) - Parameter model1_mydense_bias (shape=(20,), dtype=<type 'numpy.float32'>) - ) - - As a result, if you try to save parameters from model0 and load it with model1, you'll get an error due to unmatching names: Review comment: "load it with model1"? Might want to rephrase this. ---------------------------------------------------------------- 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] With regards, Apache Git Services
