szha commented on issue #10345: allow block setattr to reset the prefix when setting new block
URL: https://github.com/apache/incubator-mxnet/pull/10345#issuecomment-377826295
This shouldn't be considered as hack. The proposed changes work under the following constraints:
1. the parameters of a block/hybridblock should always be able to be saved and loaded.
2. our block/hybridblock supports setattr with other block/hybridblocks.
3. when doing `net2.block1 = net1.block1`, `net1` and `net2` should continue to function
normally.
Currently, the problem is that for 3., if `net1` and `net2` don't have the same prefix,
1. is violated. I don't think this is "unintended use case" since this is allowed under current
design. I don't believe that forcing users to always do `with net2.name_scope(): create_net1()`
will be productive, nor will it be easy to use.
Given that currently the block prefixes must match in order for the save and load to function
normally, I really can't think of a reason why we should allow prefixes not to match.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
|