我有(2)个相同的模型:
如何使用TensorFlowJs在Model1和Model2之间获得增量?
const Model1 = tf.sequential();
Model1.add(tf.layers.dense({units: 50, inputShape: [1], activation: 'relu', kernel_regularizer: 'l2'}));
Model1.add(tf.layers.dense({units: 1, inputShape: [1], activation: 'sigmoid'}));
Model1.compile({loss: 'binaryCrossentropy', optimizer: 'rmsprop', metrics: 'accuracy'});
const Model2 = tf.sequential();
Model2.add(tf.layers.dense({units: 50, inputShape: [1], activation: 'relu', kernel_regularizer: 'l2'}));
Model2.add(tf.layers.dense({units: 1, inputShape: [1], activation: 'sigmoid'}));
Model2.compile({loss: 'binaryCrossentropy', optimizer: 'rmsprop', metrics: 'accuracy'});
# train/fit Model1 with base dataset
# train/fit Model2 with base dataset + additional dataset
# get difference between Model1 and Model2 with TensorFlowJs here
我希望得到Model1和Model2之间的权重差