MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / zeros_like

Function zeros_like

tensorflow/python/ops/array_ops.py:2356–2382  ·  view source on GitHub ↗

Creates a tensor with all elements set to zero. Given a single tensor (`tensor`), this operation returns a tensor of the same type and shape as `tensor` with all elements set to zero. Optionally, you can use `dtype` to specify a new type for the returned tensor. For example: ```python

(tensor, dtype=None, name=None, optimize=True)

Source from the content-addressed store, hash-verified

2354@tf_export(v1=["zeros_like"])
2355@dispatch.add_dispatch_support
2356def zeros_like(tensor, dtype=None, name=None, optimize=True):
2357 """Creates a tensor with all elements set to zero.
2358
2359 Given a single tensor (`tensor`), this operation returns a tensor of the
2360 same type and shape as `tensor` with all elements set to zero. Optionally,
2361 you can use `dtype` to specify a new type for the returned tensor.
2362
2363 For example:
2364
2365 ```python
2366 tensor = tf.constant([[1, 2, 3], [4, 5, 6]])
2367 tf.zeros_like(tensor) # [[0, 0, 0], [0, 0, 0]]
2368 ```
2369
2370 Args:
2371 tensor: A `Tensor`.
2372 dtype: A type for the returned `Tensor`. Must be `float16`, `float32`,
2373 `float64`, `int8`, `uint8`, `int16`, `uint16`, `int32`, `int64`,
2374 `complex64`, `complex128`, `bool` or `string`.
2375 name: A name for the operation (optional).
2376 optimize: if true, attempt to statically determine the shape of 'tensor' and
2377 encode it as a constant.
2378
2379 Returns:
2380 A `Tensor` with all elements set to zero.
2381 """
2382 return zeros_like_impl(tensor, dtype, name, optimize)
2383
2384
2385@tf_export("zeros_like", v1=[])

Callers

nothing calls this directly

Calls 1

zeros_like_implFunction · 0.85

Tested by

no test coverage detected