小编mys*_*tea的帖子

JavaScript中的RegExp /\c /

RegExp /\c/不会触发任何语法错误.

问题是为什么它不是语法错误.由于语言天赋,我猜Pattern→交通Disjunction→交通Alternative→交通Term→交通Atom→交通\ AtomEscape→交通CharacterEscape→交通IdentityEscape的话,就到达SourceCharacter but not c,它不通过的情况相符but not c.

https://www.ecma-international.org/ecma-262/8.0/#sec-regular-expressions-patterns

我想知道我是不是错了.

javascript

6
推荐指数
1
解决办法
174
查看次数

关于TensorFlow.js中tf.Model的内存管理

我是TensorFlow的新手.

https://js.tensorflow.org/tutorials/core-concepts.html中的"内存管理:disposetf.tidy"部分说我们必须以特殊方式管理记忆.

但是,tfjs-layers(例如tf.ModelLayer)中的类似乎没有dispose并且tf.tidy不接受那些作为返回值.

所以我的问题是:

  • 是否tf.Model自动管理的回忆?
  • 如果不是,我该如何正确管理记忆?

示例代码:

function defineModel(
    regularizerRate: number,
    learningRate: number,
    stateSize: number,
    actionSize: number,
): tf.Model {
    return tf.tidy(() => { // Compile error here, I couldn't return model.
        const input = tf.input({
            name: "INPUT",
            shape: [stateSize],
            dtype: "int32" as any, // TODO(mysticatea): https://github.com/tensorflow/tfjs/issues/120
        })
        const temp = applyHiddenLayers(input, regularizerRate)
        const valueOutput = applyValueLayer(temp, regularizerRate)
        const policyOutput = applyPolicyLayer(temp, actionSize, …
Run Code Online (Sandbox Code Playgroud)

javascript tensorflow tensorflow.js

3
推荐指数
1
解决办法
879
查看次数

标签 统计

javascript ×2

tensorflow ×1

tensorflow.js ×1