function ones(shape, dtype = "float32") {
    (0, _utilBase.assertNonNegativeIntegerDimensions)(shape);
    if (dtype === "complex64") {
        const real = ones(shape, "float32");
        const imag = (0, _zeros.zeros)(shape, "float32");
        return (0, _complex.complex)(real, imag);
    }
    const values = (0, _util.makeOnesTypedArray)((0, _util.sizeFromShape)(shape), dtype);
    return (0, _engine.ENGINE).makeTensor(values, shape, dtype);
}
Creates a `tf.Tensor` with all elements set to 1.

```js
tf.ones([2, 2]).print();
```

@param shape An array of integers defining the output tensor shape.
@param dtype The type of an element in the resulting tensor. Defaults to
    'float'.

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