1. 程式人生 > >[TensorFlow] demo1 tf.zeros 函式

[TensorFlow] demo1 tf.zeros 函式

定義的檔案路徑:tensorflow/python/ops/array_ops.py.

舉個例子:

tf.zeros([3, 4], tf.int32)  # [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]

可以看出,建立一個數組並初始化它們都為0

Args:

shape: A list of integers, a tuple of integers, or a 1-D Tensor of type int32.
dtype: The type of an element in the resulting Tensor.
name: A name for the operation (optional).
Returns:
A Tensor with all elements set to zero.