function createScalarValue(value, dtype) {
    if (dtype === "string") return encodeString(value);
    return toTypedArray([
        value
    ], dtype);
}
Flattens an arbitrarily nested array.

```js
const a = [[1, 2], [3, 4], [5, [6, [7]]]];
const flat = tf.util.flatten(a);
console.log(flat);
```

 @param arr The nested array to flatten.
 @param result The destination array which holds the elements.
 @param skipTypedArray If true, avoids flattening the typed arrays. Defaults
     to false.

@doc {heading: 'Util', namespace: 'util'}