node_setup.js 433 B

123456789101112
  1. const cv = require('./opencv');
  2. const webnn = require(process.env.WEBNN_NATIVE_DIR+'/../../node/lib/webnn');
  3. // navigator is undefined in node.js, but defined in electron.js.
  4. if (global.navigator === undefined) {
  5. global.navigator = {};
  6. }
  7. global.navigator.ml = webnn.ml;
  8. global.MLContext = webnn.MLContext
  9. global.MLGraphBuilder = webnn.MLGraphBuilder
  10. global.MLGraph = webnn.MLGraph
  11. global.MLOperand = webnn.MLOperand
  12. global.cv = cv;