function scalar(value, dtype) {
    if (((0, _util.isTypedArray)(value) && dtype !== "string" || Array.isArray(value)) && dtype !== "complex64") throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");
    if (dtype === "string" && (0, _util.isTypedArray)(value) && !(value instanceof Uint8Array)) throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");
    const shape = [];
    const inferredShape = [];
    return (0, _tensorOpsUtil.makeTensor)(value, shape, inferredShape, dtype);
}
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 using `tf.scalar` as it makes the code more readable.

```js
tf.scalar(3.14).print();
```

@param value The value of the scalar.
@param dtype The data type.

@doc {heading: 'Tensors', subheading: 'Creation'}