The Float16Array
typed array represents an array of 16-bit floating point numbers in the platform byte order. If control over byte order is needed, use DataView
instead. The contents are initialized to 0
unless initialization data is explicitly provided. Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation).
Float16Array
is a subclass of the hidden TypedArray
class.
Note: Float16 support is not universal, both in the JavaScript API and the underlying CPU architecture. Using it may result in slower performance on some platforms. It is intended for interacting with highly optimized and performance-sensitive systems such as float-backed canvases, WebGPU, WebGL, and deep learning models including stable diffusion.