in src/plugin/utils/wechat_platform.ts [84:104]
export function setupWechatPlatform(config: SystemConfig, debug = false): void {
const tf = config.tf as typeof tfjs;
const backendName = config.backendName || WECHAT_WEBGL_BACKEND_NAME;
if (debug) {
console.log(tf);
}
// Skip initialization if the backend has been set.
if (tf.getBackend() === backendName) {
return;
}
const webgl = config.webgl as typeof webgl_backend;
tf.ENV.setPlatform('wechat', new PlatformWeChat(config.fetchFunc));
setBase64Methods(tf);
if (config.webgl && config.canvas) {
initWebGL(tf, webgl, config.canvas, backendName, debug);
} else {
console.log(
'webgl backend is not initialized, ' +
'please inject webgl backend and the offscreen canvas.');
}
}