html52.com
我爱小程序-开发者交流社区

tensorflow使用wasm backend始终报错

问题类型 插件 AppID 插件版本号 AppID 微信版本 基础库版本
Bug wx6afed118d9e81df9 0.2.0 wx44b8267553c811fc 8.0.32 2.16.1

tensorflow使用wasm backend始终报错 WebAssembly.instantiate: first argument must be a string。

tfjs-backend-wasm和tfjs-core都是用的3.13.0。

plugin.configPlugin({

                    // polyfill fetch function

                    fetchFunc: fetchWechat.fetchFunc(),

                    // inject tfjs runtime

                    tf,

                    // inject webgl backend

                    webgl,

                    // inject cpu backend

                    cpu,

                    // provide webgl canvas

                    canvas: wx.createOffscreenCanvas(),

                    backendName: 'wechat-webgl-' + Date.now()

                },

                true);

            const info = wx.getSystemInfoSync();

            console.log(info.platform);

            if (info.platform == 'android') {

                setWasmPath(

                    'https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm@2.0.0/wasm-out/tfjs-backend-wasm.wasm',

                    true);

                await tf.setBackend('wasm').then(() => console.log('set wasm backend'));

            }




网友回复

Mr.YAO:

WXWebAssembly 已不再支持使用网络地址。

请参考 https://developers.weixin.qq.com/miniprogram/dev/framework/performance/wasm.html

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付