function data3DLayoutForGL(typedarrayConstructor, arr, shape) {
  const data = new typedarrayConstructor(arr.data.length)
  const slice = ndarray(new typedarrayConstructor(shape[0] * shape[1]), [shape[0], shape[1]])
  let offset = 0
  for (let i = 0; i < shape[2]; i++) {
    ops.assign(slice, arr.pick(null, null, i))
    data.set(slice.data, offset)
    offset += shape[0] * shape[1]
  }

  return data
}
Shuffle ndarray data layout for WebGL
- data for TEXTURE_2D_ARRAY or TEXTURE_3D laid out sequentially per-slice

@param {TypedArray} typedarrayConstructor
@param {Object} arr - ndarray tensor
@param {number[]} shape