tf.keras.ops.empty_like

Return a new uninitialized tensor with the same shape and dtype as x.

x Input tensor to mimic shape and dtype.
dtype Optional data type. If None, uses x.dtype.

A tensor with the same shape and dtype as x, with arbitrary contents.

Example:

from keras import ops
x = ops.ones((2, 3), dtype="float32")
y = ops.empty_like(x)
y.shape
(2, 3)
y.dtype
dtype('float32')