model = tf.sequential();
a = tf.layers.input({shape: [127,]});
b = tf.layers.dense({units:64, inputShape: [127,], activation: 'relu' }).apply(a)
c = tf.layers.dropout(0.5).apply(b)
d = tf.layers.dense({units:64, activation: 'relu'}).apply(c)
e = tf.layers.dropout(0.5).apply(d)
f = tf.layers.dense({units:12, activation: 'sigmoid'}).apply(e)
model = tf.model({inputs: a, outputs: f});
model.compile({
optimizer: 'rmsprop',
loss: 'meanSquaredError',
metrics: 'accuracy'
});
console.log(model.summary());
await model.fit(input1:XS[1].split(','), {main_output:YS[1].split(',')}, {epochs: 50});
这里XS [1]的形状为(127,),YS [1]的形状为(12,),我根据'\ n'和','进行了分割,仍然存在错误。任何帮助将不胜感激!
答案 0 :(得分:1)
我通过以某种方式包装输入和输出来修复它 {input1:tf.tensor(Array(XS [1] .split(','))))},{main_output:tf.tensor(Array(YS [1] .split(',')))}}