-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add support for half type for the http restful api #1753
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
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
case DT_HALF: | ||
int src = tensor.half_val(*offset); | ||
float dst; | ||
dst = toFloat16( &src, &dst); |
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.
dont roll your own version for float16 conversion (its hard to get that correct). instead use standard @FP16 library that is used in TF. specifically use fp16_ieee_from_fp32_value() API (from fp16.h), and write the output as decimal number.
you can refer to the fp16 library via @FP16 bazel target in the BUILD file.
also your change is incomplete. you need to handle input conversion (json -> tensor) for DT_HALF. please update AddValueToTensor() method.
and finally add unit tests for your code.
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.
Thank you , I'll try.
I think you can adjust the type of input through |
Hi, I'm facing the same problem and I'd like to know when this pr will be approved. |
Half type is widely used in the deeplearning inference, but the tf-serving doesn't support half type in the restful api,
I submit a pr to solve this problem, please check.