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

[NODE][Serialization]fix serialization precision loss in float #4503

Merged
merged 2 commits into from
Dec 12, 2019

Conversation

HisiFish
Copy link
Contributor

When we want to serialize(such as pickle.dumps) a tvm.tensor object, we will get a precision loss caused by std::to_string()。
For example, a2.value will be 0.0 while a.value=0.00000001 in the following:
import tvm
import pickle
a = tvm.const(0.00000001, 'float32')
a2 = pickle.loads(pickle.dumps(a))

Thanks for contributing to TVM! Please refer to guideline https://docs.tvm.ai/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from Reviewers by @ them in the pull request thread.

When we want to serialize a tvm.tensor object(like pickle), we will get a precision loss cause by std::to_string()。
For example, a2.value will be 0.0 while a.value=0.00000001 in the following: 
    import tvm
    import pickle
    a = tvm.const(0.00000001, 'float32')
    a2 = pickle.loads(pickle.dumps(a))
@HisiFish HisiFish changed the title fix serialization precision loss in float [NODE][SERIALIZATION]fix serialization precision loss in float Dec 11, 2019
@HisiFish HisiFish changed the title [NODE][SERIALIZATION]fix serialization precision loss in float [NODE][Serialization]fix serialization precision loss in float Dec 11, 2019
Copy link
Member

@junrushao junrushao left a comment

Choose a reason for hiding this comment

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

LGTM

@HisiFish
Copy link
Contributor Author

HisiFish commented Dec 12, 2019

@junrushao1994 Hi, Shao, what should I do before this PR merged? It's the 1st time I start a pr to TVM. Not very clear to the rules.

@junrushao
Copy link
Member

You should @ maintainers (aka committers how have permission to merge) on this thread. They will look at the patch and decide. Thanks!

Copy link
Member

@zhiics zhiics left a comment

Choose a reason for hiding this comment

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

@HisiFish Welcome to the TVM community and thanks for your contribution! This change sounds good to me.

@zhiics zhiics merged commit 8c2d4f6 into apache:master Dec 12, 2019
zxy844288792 pushed a commit to zxy844288792/tvm that referenced this pull request Dec 13, 2019
…e#4503)

* fix serialization precision loss in float

When we want to serialize a tvm.tensor object(like pickle), we will get a precision loss cause by std::to_string()。
For example, a2.value will be 0.0 while a.value=0.00000001 in the following: 
    import tvm
    import pickle
    a = tvm.const(0.00000001, 'float32')
    a2 = pickle.loads(pickle.dumps(a))

* remove line end spaces
zxy844288792 pushed a commit to neo-ai/tvm that referenced this pull request Dec 13, 2019
…e#4503)

* fix serialization precision loss in float

When we want to serialize a tvm.tensor object(like pickle), we will get a precision loss cause by std::to_string()。
For example, a2.value will be 0.0 while a.value=0.00000001 in the following: 
    import tvm
    import pickle
    a = tvm.const(0.00000001, 'float32')
    a2 = pickle.loads(pickle.dumps(a))

* remove line end spaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants