Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have a generator function it returns data & label value to the async function. I get an error message as not inputting data to the model

Also, I can not get value inside in async function. I am new to javascript. then how I can fix it. please help me. thank you...

This is my code...



JavaScript
async function* data() {
  while (true) {
    for (i in train) {
      var data = [1, 2, 3, 4];
      var size = [2, 2, 1];
      yield (tf.tensor3d(data, size).div(tf.scalar(255.)));  // this function return tensor 3D as input data
    }
  }
}
async function* labels() {
  while (true) {
    for (i in train) {
      var data = [1, 2, 3, 4];
      var size = [2, 2];
      yield (tf.tensor2d(data, size).expandDims(2));  // this function return tensor 2D as input label
    }
  }
}

async function initModel() {
   //my model write here
}


(async function () {

const xs = tf.data.generator(data);
const ys = tf.data.generator(labels);

const model = await initModel();
model.summary();

console.log(xs, ys) // not showing output

 await model.fit(xs, ys,{    
    epochs: 5
    batchesPerEpoch: 5 
  });
})();


What I have tried:

Getting out from xs and ys when console logs it not showing anything.
also, feed into the model it shows error not getting any input for the model
Posted
Updated 17-Aug-20 17:51pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900