• Creates rank-1 tf.Tensor with the provided values, shape and dtype.

    The same functionality can be achieved with tf.tensor, but in general we recommend using tf.tensor1d as it makes the code more readable.

    tf.tensor1d([1, 2, 3]).print();
    

    Parameters

    • values: TensorLike1D

      The values of the tensor. Can be array of numbers, or a TypedArray.

    • Optionaldtype: keyof DataTypeMap

      The data type.

    Returns Tensor1D