Instantiates an all-zeros variable of the same shape as another tensor. Arguments: x: Keras variable or Keras tensor. dtype: dtype of returned Keras variable. `None` uses the dtype of `x`. name: name for the variable to create. Returns: A Keras variable wit
(x, dtype=None, name=None)
| 1371 | |
| 1372 | @keras_export('keras.backend.zeros_like') |
| 1373 | def zeros_like(x, dtype=None, name=None): |
| 1374 | """Instantiates an all-zeros variable of the same shape as another tensor. |
| 1375 | |
| 1376 | Arguments: |
| 1377 | x: Keras variable or Keras tensor. |
| 1378 | dtype: dtype of returned Keras variable. |
| 1379 | `None` uses the dtype of `x`. |
| 1380 | name: name for the variable to create. |
| 1381 | |
| 1382 | Returns: |
| 1383 | A Keras variable with the shape of `x` filled with zeros. |
| 1384 | |
| 1385 | Example: |
| 1386 | |
| 1387 | ```python |
| 1388 | from tensorflow.keras import backend as K |
| 1389 | kvar = K.variable(np.random.random((2,3))) |
| 1390 | kvar_zeros = K.zeros_like(kvar) |
| 1391 | K.eval(kvar_zeros) |
| 1392 | # array([[ 0., 0., 0.], [ 0., 0., 0.]], dtype=float32) |
| 1393 | ``` |
| 1394 | |
| 1395 | """ |
| 1396 | return array_ops.zeros_like(x, dtype=dtype, name=name) |
| 1397 | |
| 1398 | |
| 1399 | @keras_export('keras.backend.ones_like') |
no outgoing calls
no test coverage detected