Skip to content

Commit

Permalink
Update docs and test cases for missing types in tf.zeros_like (tens…
Browse files Browse the repository at this point in the history
…orflow#15934)

* Update docs for missing types in `tf.zeros_like`

This fix update docs for missing types in `tf.zeros_like`
where `half` and `string` are supported but
not listed.

Signed-off-by: Yong Tang <[email protected]>

* Also enable test cases for missing types to `tf.zeros_like`

Signed-off-by: Yong Tang <[email protected]>
  • Loading branch information
yongtang authored and rmlarsen committed Jan 24, 2018
1 parent 23ed83d commit 7ed8525
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
14 changes: 8 additions & 6 deletions tensorflow/python/kernel_tests/constant_op_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,18 +454,20 @@ def _compareZeros(self, dtype, fully_defined_shape, use_gpu):

def testZerosLikeCPU(self):
for dtype in [
dtypes_lib.float32, dtypes_lib.float64, dtypes_lib.int8,
dtypes_lib.uint8, dtypes_lib.int16, dtypes_lib.uint16, dtypes_lib.int32,
dtypes_lib.int64, dtypes_lib.bool, dtypes_lib.complex64,
dtypes_lib.complex128, dtypes_lib.string
dtypes_lib.half, dtypes_lib.float32, dtypes_lib.float64,
dtypes_lib.int8, dtypes_lib.uint8, dtypes_lib.int16, dtypes_lib.uint16,
dtypes_lib.int32, dtypes_lib.int64, dtypes_lib.bool,
dtypes_lib.complex64, dtypes_lib.complex128, dtypes_lib.string
]:
self._compareZeros(dtype, fully_defined_shape=False, use_gpu=False)
self._compareZeros(dtype, fully_defined_shape=True, use_gpu=False)

def testZerosLikeGPU(self):
for dtype in [
dtypes_lib.float32, dtypes_lib.float64, dtypes_lib.int32,
dtypes_lib.bool, dtypes_lib.int64, dtypes_lib.string
dtypes_lib.half, dtypes_lib.float32, dtypes_lib.float64,
dtypes_lib.int32, dtypes_lib.int64,
dtypes_lib.complex64, dtypes_lib.complex128,
dtypes_lib.bool
]:
self._compareZeros(dtype, fully_defined_shape=False, use_gpu=True)
self._compareZeros(dtype, fully_defined_shape=True, use_gpu=True)
Expand Down
6 changes: 3 additions & 3 deletions tensorflow/python/ops/array_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1588,9 +1588,9 @@ def zeros_like(tensor, dtype=None, name=None, optimize=True):
Args:
tensor: A `Tensor`.
dtype: A type for the returned `Tensor`. Must be `float32`, `float64`,
`int8`, `uint8`, `int16`, `uint16`, int32`, `int64`,
`complex64`, `complex128` or `bool`.
dtype: A type for the returned `Tensor`. Must be `float16`, `float32`,
`float64`, `int8`, `uint8`, `int16`, `uint16`, `int32`, `int64`,
`complex64`, `complex128`, `bool` or `string`.
name: A name for the operation (optional).
optimize: if true, attempt to statically determine the shape of 'tensor'
and encode it as a constant.
Expand Down

0 comments on commit 7ed8525

Please sign in to comment.