Like the proposal mentioned in issue, running full_hook._name_ = (hook._repr_()) in add_hook may cause large overhead in some situation. This PR add a new parameter skip_verbose_naming that allows user to skip this line.
Fixes #631
Type of change
Please delete options that are not relevant.
[ ] New feature (non-breaking change which adds functionality)
Screenshots
The overhead caused by naming being removed by adding skip_verbose_naming=True in with model.hooks(fwd_hooks=fwd_hooks, skip_verbose_naming=True):.
Before
After
Checklist:
[x] I have commented my code, particularly in hard-to-understand areas
[x] I have made corresponding changes to the documentation
[x] My changes generate no new warnings
[ ] I have added tests that prove my fix is effective or that my feature works
[ ] New and existing unit tests pass locally with my changes
[ ] I have not rewritten tests relating to key interfaces which would affect backward compatibility
There is some problem with the current unit test here:
After my changes, the parameter would be different for add_hook. Should I do anything about it?
Description
Like the proposal mentioned in issue, running
full_hook._name_ = (hook._repr_())
in add_hook may cause large overhead in some situation. This PR add a new parameterskip_verbose_naming
that allows user to skip this line.Fixes #631
Type of change
Please delete options that are not relevant.
Screenshots
The overhead caused by naming being removed by adding
skip_verbose_naming=True
inwith model.hooks(fwd_hooks=fwd_hooks, skip_verbose_naming=True):
.Checklist:
There is some problem with the current unit test here:
After my changes, the parameter would be different for add_hook. Should I do anything about it?