constructor(config = {}) {
    const {
      filepath = null,
      headers = {},
      filesystem = false,
      gpu = false,
      transferLayerOutputs = false,
      pauseAfterLayerCalls = false,
      visualizations = []
    } = config

    if (!filepath) {
      throw new Error('[Model] path to protobuf-serialized model definition file is missing.')
    }
    this.filepath = filepath

    // HTTP(S) headers used during data fetching
    this.headers = headers

    // specifies that data files are from local file system (Node.js only)
    this.filesystem = typeof window !== 'undefined' ? false : filesystem

    // event emitter
    this.events = new EventEmitter()

    // Model config
    this.id = null
    this.name = null
    this.kerasVersion = null
    this.backend = null
    this.modelConfig = {}
    this.modelWeights = []

    // flag to enable GPU where possible (disable in node environment)
    this.gpu = typeof window !== 'undefined' && webgl2.isSupported ? gpu : false

    // in GPU mode, transfer intermediate outputs of each layer from GPU->CPU
    this.transferLayerOutputs = transferLayerOutputs

    // break up blocking computation by layer, to allow for intervening DOM updates, for example
    this.pauseAfterLayerCalls = pauseAfterLayerCalls

    // array of model layers info
    this.modelLayersInfo = []

    // map of model layers
    this.modelLayersMap = new Map()

    // map of input tensors
    this.inputTensorsMap = new Map()

    // names of input and output layers
    this.inputLayerNames = []
    this.outputLayerNames = []

    // array of model layer names with finished output
    this.finishedLayerNames = []

    // flag while computations are being performed
    this.isRunning = false

    // running progress values
    this.runningProgress = 0

    // stats object for last `predict` call
    this.predictStats = {}

    // visualizations to calculate
    this.visMap = new Map()
    visualizations.forEach(v => {
      if (v in visMethods) {
        const visInstance = new visMethods[v]({ modelLayersMap: this.modelLayersMap, gpu: this.gpu })
        this.visMap.set(v, visInstance)
      }
    })

    // Promise for when Model class is initialized
    this._ready = this._initialize()
  }
Create new Model class

@param {string} config.filepath - path to protobuf-serialized model definition file
@param {Object} [config.headers] - any additional HTTP headers required for resource fetching
@param {Object} [config.filesystem] - specifies that data files are from local file system (Node.js only)
@param {boolean} [config.gpu] - enable GPU
@param {boolean} [config.transferLayerOutputs] - in GPU mode, transfer outputs of each layer from GPU->CPU (warning: decreases performance)
@param {boolean} [config.pauseAfterLayerCalls] - break up blocking computation by layer, to allow for intervening DOM updates, for example
@param {string[]} [config.visualizations] - specifies which visualizations to calculate