Creates rank-0 tf.Tensor (scalar) with the provided value and dtype.
tf.Tensor
The same functionality can be achieved with tf.tensor, but in general we recommend using tf.scalar as it makes the code more readable.
tf.tensor
tf.scalar
tf.scalar(3.14).print(); Copy
tf.scalar(3.14).print();
The value of the scalar.
Optional
The data type.
Creates rank-0
tf.Tensor
(scalar) with the provided value and dtype.The same functionality can be achieved with
tf.tensor
, but in general we recommend usingtf.scalar
as it makes the code more readable.