replaceTensorData(data) {
    if (data && data.length && data instanceof this.arrayType) {
      this.tensor.data.set(data)
    } else if (data && data.length && data instanceof Array) {
      this.tensor.data.set(new this.arrayType(data))
    } else {
      throw new Error('[Tensor] invalid input for replaceTensorData method.')
    }

    if (this.glTexture) {
      const gl = webgl2.context
      const textureOptions = webgl2.getWebGLTextureOptions(this.glTextureType, this.glTextureFormat)
      const { textureTarget, textureFormat, textureType } = textureOptions
      gl.bindTexture(textureTarget, this.glTexture)

      const shape = this.glTextureShape
      if (this.glTextureType === '2d') {
        const data = this.tensor.data
        gl.texSubImage2D(textureTarget, 0, 0, 0, shape[1], shape[0], textureFormat, textureType, data, 0)
      } else if (this.glTextureType === '2d_array' || this.glTextureType === '3d') {
        const data = tensorUtils.data3DLayoutForGL(this.arrayType, this.tensor, shape)
        gl.texSubImage3D(textureTarget, 0, 0, 0, 0, shape[1], shape[0], shape[2], textureFormat, textureType, data, 0)
      }
    }
  }
Replaces data in the underlying ndarray, and the corresponding WebGLTexture if glTexture is present

@param {number[]} data