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

Improve fast_tensor_util for bfloat16 #19533

Merged
merged 3 commits into from
Jul 26, 2018

Conversation

yongtang
Copy link
Member

@yongtang yongtang commented May 24, 2018

In #19212, improvement has been done to speed up the fast_tensor_util for float16. As both float16
and bfloat16 uses the same size, bfloat16 could be improved as well. This fix speeds up bfloat16 in a similiar fashion as float16.

This fix is related to #19212.

Signed-off-by: Yong Tang yong.tang.github@outlook.com

In 19180, improvement has been done to speed up the
fast_tensor_util for `float16`. As both `float16`
and `bfloat16` uses the same size, `bfloat16`
could be improved as well. This fix speeds up `bfloat16`
in a similiar fashion as `float16`.

This fix is related to 19180.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
@tensorflowbutler
Copy link
Member

Nagging Reviewer @rmlarsen: It has been 14 days with no activity and the awaiting review label was assigned. Can you please take a look?

@tensorflowbutler
Copy link
Member

Nagging Reviewer @rmlarsen: It has been 29 days with no activity and the awaiting review label was assigned. Can you please take a look?

@tensorflowbutler
Copy link
Member

Nagging Reviewer @rmlarsen: It has been 44 days with no activity and the awaiting review label was assigned. Can you please take a look?

@rmlarsen
Copy link
Member

@yongtang is this covered by existing unit tests?

@yongtang
Copy link
Member Author

@rmlarsen Yes the related unit test is in:

def testBfloat16(self):
test_type = dtypes.bfloat16.as_numpy_dtype
t = tensor_util.make_tensor_proto(np.array([10.0, 20.0], dtype=test_type))
# 10.0: 16672 = 010000010(130) 0100000: (1+0/2+1/4) * 2^(130-127)
# 20.0: 16800 = 010000011(131) 0100000: (1+0/2+1/4) * 2^(131-127)
self.assertProtoEquals("""
dtype: DT_BFLOAT16
tensor_shape {
dim {
size: 2
}
}
half_val: 16672
half_val: 16800
""", t)
a = tensor_util.MakeNdarray(t)
self.assertEquals(test_type, a.dtype)
self.assertAllClose(np.array([10.0, 20.0], dtype=test_type), a)

@tensorflowbutler tensorflowbutler removed the awaiting review Pull request awaiting review label Jul 18, 2018
@rmlarsen rmlarsen added ready to pull PR ready for merge process kokoro:run labels Jul 20, 2018
@tensorflow-copybara tensorflow-copybara merged commit 535fa49 into tensorflow:master Jul 26, 2018
tensorflow-copybara pushed a commit that referenced this pull request Jul 26, 2018
@yongtang yongtang deleted the 19180-bfloat16 branch July 26, 2018 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes ready to pull PR ready for merge process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants