📅  最后修改于: 2023-12-03 15:05:32.902000             🧑  作者: Mango
tf.layers.getConfig()
方法返回当前层的配置参数。这些配置参数可以用于编写自定义层或在恢复模型权重时使用。
tf.layers.getConfig(): LayerConfig;
返回值:一个包含当前层配置参数的 LayerConfig
对象。
const input = tf.input({ shape: [4] });
const denseLayer = tf.layers.dense({ units: 8, activation: 'relu' });
const output = denseLayer.apply(input);
console.log(denseLayer.getConfig());
输出:
{
name: 'dense',
trainable: true,
batchInputShape: [null, 4],
dtype: 'float32',
units: 8,
kernelInitializer:
{ className: 'VarianceScaling',
config: { scale: 1, mode: 'fanAvg', distribution: 'uniform' } },
biasInitializer:
{ className: 'Zeros', config: {} },
activation: 'relu',
useBias: true,
kernelRegularizer: null,
biasRegularizer: null,
activityRegularizer: null,
kernelConstraint: null,
biasConstraint: null
}