Skip to content

tf.enableDebugMode() cause an error #62

@dinfer

Description

@dinfer

To get help from the community, we encourage using Stack Overflow and the tensorflow.js tag.

TensorFlow.js version: 1.7.2
tfjs-wechat plugin version: 0.0.9
WeChat version: 微信开发者工具
WeChat base API version: 2.10.4
WeChat IDE version: 1.02.2004020
Describe the problem or feature request: calling of tfjs.enableDebugMode makes the tfjs access BOM object, which are not accessible in wechat. that behaviour causes Cannot read property 'userAgent' of undefined

Code to reproduce the bug / link to feature request

the code:

    tf.enableDebugMode()

the error

Uncaught (in promise) thirdScriptError
Cannot read property 'userAgent' of undefined
TypeError: Cannot read property 'userAgent' of undefined
    at Object.evaluationFn (http://127.0.0.1:26467/appservice/miniprogram_npm/@tensorflow/tfjs-core/index.js:17:73072)
    at t.evaluateFlag (http://127.0.0.1:26467/appservice/miniprogram_npm/@tensorflow/tfjs-core/index.js:17:3160)
    at t.get (http://127.0.0.1:26467/appservice/miniprogram_npm/@tensorflow/tfjs-core/index.js:17:2468)
    at t.getNumber (http://127.0.0.1:26467/appservice/miniprogram_npm/@tensorflow/tfjs-core/index.js:17:2546)
    at e.startTimer (http://127.0.0.1:26467/appservice/miniprogram_npm/@tensorflow/tfjs-core/index.js:17:294533)
    at e.runWebGLProgram (http://127.0.0.1:26467/appservice/miniprogram_npm/@tensorflow/tfjs-core/index.js:17:334813)
    at e.uploadToGPU (http://127.0.0.1:26467/appservice/miniprogram_npm/@tensorflow/tfjs-core/index.js:17:337786)
    at http://127.0.0.1:26467/appservice/miniprogram_npm/@tensorflow/tfjs-core/index.js:17:333339
    at Array.map (<anonymous>)
    at e.runWebGLProgram (http://127.0.0.1:26467/appservice/miniprogram_npm/@tensorflow/tfjs-core/index.js:17:332630)

what causes the error(i'm using minified code of tfjs)

navigator.userAgent || navigator.vendor || window.opera

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions