Skip to content
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

Merged
merged 1 commit into from Jul 29, 2020
Merged

Conversation

sleepwalker2017
Copy link
Contributor

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.

@@ -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)]
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@kevinthesun kevinthesun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kevinthesun kevinthesun merged commit 2ce1193 into apache:master Jul 29, 2020
@kevinthesun
Copy link
Contributor

Thanks @sleepwalker2017

trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Aug 26, 2020
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Aug 26, 2020
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Aug 26, 2020
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Sep 2, 2020
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants