constructor(data, shape, options = {}) {
    this.arrayType = options.type || Float32Array

    if (data && data.length && (data instanceof this.arrayType || data instanceof Array)) {
      tensorUtils.checkShape(data, shape)
      if (data instanceof this.arrayType) {
        this.tensor = ndarray(data, shape)
      } else if (data instanceof Array) {
        this.tensor = ndarray(new this.arrayType(data), shape)
      }
    } else if (!data.length && shape.length) {
      // if shape present but data not provided, initialize with 0s
      this.tensor = ndarray(new this.arrayType(shape.reduce((a, b) => a * b, 1)), shape)
    } else {
      this.tensor = ndarray(new this.arrayType([]), [])
    }
  }
Creates a tensor

@param {(TypedArray|Array)} data
@param {number[]} shape
@param {Object} [options]