-1
 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' 和 ',' 进行了拆分,但错误仍然存​​在。任何帮助将不胜感激!

4

1 回答 1

1

我通过以 {input1:tf.tensor(Array(XS[1].split(',')))},{main_output:tf.tensor(Array(YS[1].分裂(',')))}

于 2018-08-27T11:23:00.227 回答