Skip to content

Conversation

@daspecster
Copy link
Contributor

@daspecster daspecster commented Feb 13, 2017

Build is failing due to float precision.
See: https://circleci.com/gh/GoogleCloudPlatform/google-cloud-python/876

Clarification: float (i.e. single) vs. double. Double values are being cast down into float (which is correct, but is also a breaking change). For example

>>> (0.9224355).hex()
'0x1.d849774256bcap-1'
>>> from google.cloud.grpc.vision.v1 import image_annotator_pb2
>>> e = image_annotator_pb2.EntityAnnotation(score=0.9224355)
>>> e.score
0.9224355220794678
>>> e.score.hex()
'0x1.d849780000000p-1'

@daspecster daspecster added api: speech Issues related to the Speech-to-Text API. api: vision Issues related to the Cloud Vision API. labels Feb 13, 2017
@daspecster daspecster requested a review from dhermes February 13, 2017 19:08
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 13, 2017
@daspecster daspecster changed the title Switch failing floats to 1/8. Fix build failing with float precision mismatch Feb 13, 2017
}, {
'transcript': 'testing 4 5 6',
'confidence': 0.0123456,
'confidence': 0.125,

This comment was marked as spam.

}, {
'transcript': 'testing streaming 4 5 6',
'confidence': 0.0123456,
'confidence': 0.125,

This comment was marked as spam.

@dhermes
Copy link
Contributor

dhermes commented Feb 13, 2017

@lukesneeringer @geigerj Are you aware of any code paths in google.protobuf that are casting these values from double to float?

@geigerj
Copy link
Contributor

geigerj commented Feb 13, 2017

@dhermes I'm not particularly familiar with the inner workings of google.protobuf, but that seems probable given that the source proto declares score as a float, which in the proto wire format is 32-bit (https://developers.google.com/protocol-buffers/docs/encoding).

@dhermes
Copy link
Contributor

dhermes commented Feb 14, 2017

@daspecster LGTM. Let's get this merged ASAP. Squash if you'd like

@lukesneeringer lukesneeringer merged commit e4661b0 into googleapis:master Feb 14, 2017
@daspecster daspecster deleted the fix-speech-vision-float branch February 14, 2017 16:22
@dhermes
Copy link
Contributor

dhermes commented Feb 28, 2017

Whatever issue that caused this seems to have been a regression? I can't can no longer reproduce on Ubuntu 16.04 or OS X 10.11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: speech Issues related to the Speech-to-Text API. api: vision Issues related to the Cloud Vision API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants