Add python built-in types support for `tf.as_dtype` (#17652)
* Add python built-in types support for `tf.as_dtype` This fix tries to address the issue raised in 17641 where it was not possible to use `tf.as_dtype(float)` the same way as numpy `np.dtype(float)`. This fix adds the built-in types support for `tf.as_dtype`, so that it is possible to specify: ``` dtypes.as_dtype(float) # dtypes.float64 dtypes.as_dtype(int) # dtypes.int32 dtypes.as_dtype(long) # dtypes.int64 dtypes.as_dtype(complex) # dtypes.complex128 dtypes.as_dtype(bool) # dtypes.bool ``` This fix fixes 17641. Signed-off-by:Yong Tang <yong.tang.github@outlook.com> * Add test cases for built-in types support with `tf.as_dtype` Signed-off-by:
Yong Tang <yong.tang.github@outlook.com> * Fix failed test cases with added built-in types support of tf.as_dtype Signed-off-by:
Yong Tang <yong.tang.github@outlook.com> * Fix python 3 build Signed-off-by:
Yong Tang <yong.tang.github@outlook.com> * Restrict the changes to float and bool based on review feedback Signed-off-by:
Yong Tang <yong.tang.github@outlook.com>
Loading
Please sign in to comment