• Creates a tf.Tensor filled with a scalar value.

    tf.fill([2, 2], 4).print();
    

    Type Parameters

    Parameters

    • shape: ShapeMap[R]

      An array of integers defining the output tensor shape.

    • value: string | number

      The scalar value to fill the tensor with.

    • Optional dtype: keyof DataTypeMap

      The type of an element in the resulting tensor. Defaults to 'float32' if the given param value is a number, otherwise 'string'.

    Returns Tensor<R>

    Doc