Search code examples
javascripttensorflowjs-converter

TypeError: s[p].shape is undefined in firefox


 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});

Here the shape of XS[1] is (127,) and YS[1] has the shape (12,), I have made the splits based on '\n' and ',' , still the error remains. Any help will be appreciated!


Solution

  • I fixed it by wrapping the input and output in a way {input1:tf.tensor(Array(XS[1].split(',')))},{main_output:tf.tensor(Array(YS[1].split(',')))}