-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Relax] Add CopyWithNewParams interface #91
[Relax] Add CopyWithNewParams interface #91
Conversation
2f87224
to
e56e2de
Compare
I'm thinking if the struct info of params contains Var, should we copy them as well? |
@SiriusNEO I perfer not. Because we now only have to satisfy the requirement in well-formed check, which only checks parameter vars of functions. If we wanna copy all vars in the function, we may have to do this. |
The behavior and semantics of param struct info containing shape var needs more thinking, and currently we have no such example. We will revisit this point after some time and at this moment let’s just go as usual, assuming no shape var appears in the params’ structure info. |
a30c2a7
to
b5bf1ee
Compare
* copy_func pass * reformat * move interface into utils * simplify test * Change name to copy_with_new_params * remove zero-param constructor * change visitor into Transform * formatted * finish revise * revise
Co-authored-by: Prakalp Srivastava <prakalp@octoml.ai>
* copy_func pass * reformat * move interface into utils * simplify test * Change name to copy_with_new_params * remove zero-param constructor * change visitor into Transform * formatted * finish revise * revise
* copy_func pass * reformat * move interface into utils * simplify test * Change name to copy_with_new_params * remove zero-param constructor * change visitor into Transform * formatted * finish revise * revise
* copy_func pass * reformat * move interface into utils * simplify test * Change name to copy_with_new_params * remove zero-param constructor * change visitor into Transform * formatted * finish revise * revise
Co-authored-by: Prakalp Srivastava <prakalp@octoml.ai>
Co-authored-by: Prakalp Srivastava <prakalp@octoml.ai>
This is the new PR following #90 after the source branch having been moved to personal repositiory.
This PR adds a new interface
relax.utils.copy_with_new_params
to copy functions:The parameters of the original function would be copied to satisfy the restriction in the well-formed check: any two functions should not share the same parameter variable.
This interface serves for passes that needs to copy some existing function and modify it, such as
relax.transform.Gradient
.