-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[RELAY][GRAD] handle Tuple/TupleGetItem in first order gradient #5946
Conversation
@junrushao1994 @MarisaKirisame @tqchen for the friends of gradients... I have a third thing (fixing an efficiency issue I found), but it also is in |
also cc @yzhliu @icemelon9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/relay/transforms/gradient.cc
Outdated
} | ||
return Tuple(res); | ||
} else { | ||
LOG(FATAL) << "unsupported type to zero: " << tt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOG(FATAL) << "unsupported type to zero: " << tt; | |
LOG(FATAL) << "unsupported type to ones: " << tt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This goes away with the unification...
src/relay/transforms/gradient.cc
Outdated
@@ -106,14 +106,67 @@ struct ADValueNode { | |||
} | |||
}; | |||
|
|||
Expr MultiZerosType(const Type& t) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you unify MultiZeros with MultiOnes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just pushed that. Thank you for the suggestion.
…he#5946) * handle Tuple/TupleGetItem in first order gradient * Unify MultiOnes/MultiZeros.
…he#5946) * handle Tuple/TupleGetItem in first order gradient * Unify MultiOnes/MultiZeros.
This adds tuple support for first order gradients.
We may have tuples passed to or returned from functions and at this stage, they aren't inlined (because we want to compute gradients based on that granularity), limiting the possibility to eliminate Tuple/GetTupleItem.
Examples of ops with tupels include dropout and concatenate.