-
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][TF][BugFix] when converting constant nodes with types of int64 or float64 #6159
Conversation
@@ -2835,7 +2835,7 @@ def _parse_param(self, key, value, name, shape): | |||
|
|||
array_ndim = len(np_array.shape) | |||
if array_ndim == 0: | |||
self._nodes[name] = [tvm.relay.const(np_array)] | |||
self._nodes[name] = [tvm.relay.const(np_array, np_array.dtype)] |
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.
Do we also need to fix non-scalar case?
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.
For non-scalar cases, it goes to self._params[name] = tvm.nd.array(np_array).
Seems the tvm.nd.array function doesn't have a default dtype, it always gets dtype from np_array. While tvm.relay.const has a default param dtype set to 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.
LGTM
Thanks @sleepwalker2017 |
…apache#6159) Co-authored-by: yuweilong <yuweilong03@meituan.com>
…apache#6159) Co-authored-by: yuweilong <yuweilong03@meituan.com>
…apache#6159) Co-authored-by: yuweilong <yuweilong03@meituan.com>
…apache#6159) Co-authored-by: yuweilong <yuweilong03@meituan.com>
…apache#6159) Co-authored-by: yuweilong <yuweilong03@meituan.com>
when creating a constant node in relay, if dtype is not specified, inputs with int64 type will be converted to int32 type, which may cause error in following data type checks.