小编Vih*_*aAW的帖子

TensorFlowJS 中的单位和 inputShape

我是 TensorflowJS 和 ML 的新手。在API参考中,有以下代码。

const model = tf.sequential();

// First layer must have an input shape defined.
model.add(tf.layers.dense({units: 32, inputShape: [50]}));

// Afterwards, TF.js does automatic shape inference.
model.add(tf.layers.dense({units: 4}));

// Inspect the inferred shape of the model's output, which equals
// `[null, 4]`. The 1st dimension is the undetermined batch dimension; the
// 2nd is the output size of the model's last layer.
console.log(JSON.stringify(model.outputs[0].shape));
Run Code Online (Sandbox Code Playgroud)

我想知道的是,

什么是inputShape

自动形状是什么?

既然unit提到了数据集的属性,为什么unit要设置为4呢model.add(tf.layers.dense({units: 4})) …

javascript tensorflow tensorflow.js

5
推荐指数
1
解决办法
2733
查看次数

标签 统计

javascript ×1

tensorflow ×1

tensorflow.js ×1