-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add Cast-like operator #3558
Add Cast-like operator #3558
Conversation
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
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.
Please note that TestCoverage.md needs to be updated as well
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>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
inputs=['input', 'like'], | ||
outputs=['output'], | ||
) | ||
if input_type and output_type: |
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.
not sure I understand why would these 2 be None?
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 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).
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
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).