Add Cast-like operator#3558
Merged
askhade merged 10 commits intoonnx:masterfrom Jul 14, 2021
Merged
Conversation
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
jcwchen
reviewed
Jul 7, 2021
Member
jcwchen
left a comment
There was a problem hiding this comment.
Please note that TestCoverage.md needs to be updated as well
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
askhade
reviewed
Jul 8, 2021
askhade
reviewed
Jul 8, 2021
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
askhade
reviewed
Jul 9, 2021
| inputs=['input', 'like'], | ||
| outputs=['output'], | ||
| ) | ||
| if input_type and output_type: |
Contributor
There was a problem hiding this comment.
not sure I understand why would these 2 be None?
Contributor
Author
There was a problem hiding this comment.
I copied it from Cast. My guess is that minor adjustments were needed for types like bfloat16 because of the numpy doesn't support this type, so the numpy values have a different type from the intended type (so, the call to expect is different here, and the intended-type is explicitly mentioned).
askhade
approved these changes
Jul 9, 2021
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
jcwchen
approved these changes
Jul 14, 2021
askhade
approved these changes
Jul 14, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Ganesan Ramalingam grama@microsoft.com
Description
Introduces an operator CastLike(X,Y) that casts X to the same type as Y.
Motivation and Context
A common use-case in the definition of function-bodies is to produce a constant, like 0.5 or 1, of the same type/precision as an input Y. This enables such functionality (without requiring the use of a type-context and a context-dependent-function). This will also be useful in defining similar functions that are stored in a model (aka model-local functions).