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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/tvm/relay/frontend/tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

else:
self._params[name] = tvm.nd.array(np_array)
self._nodes[name] = [_expr.var(name,
Expand Down