BeTomorrow / ReImproveJS

A framework using TensorFlow.js for Deep Reinforcement Learning
MIT License
122 stars 16 forks source link

Error with example Code at step() #5

Closed Sebastian-Schuchmann closed 6 years ago

Sebastian-Schuchmann commented 6 years ago

When using your example code I get an error at Academy.step:

I do the following:

// Animation loop, update loop, whatever loop you want
async function step(time) {
    let inputs = [1,2]; 
  await academy.step([               // Let the magic operate ...
        {teacherName: teacher, agentInputs: inputs}
    ]);
}

but I always get an Error no matter what the input is:

reimprove.js:1 Uncaught (in promise) TypeError: Cannot read property 'length' of undefined
   at Agent.forward (reimprove.js:1)
    at Agent.listen (reimprove.js:1)
    at reimprove.js:1
    at Set.forEach (<anonymous>)
    at Teacher.<anonymous> (reimprove.js:1)
    at step (reimprove.js:1)
    at Object.next (reimprove.js:1)
    at reimprove.js:1
    at new Promise (<anonymous>)
    at __awaiter (reimprove.js:1)
Sebastian-Schuchmann commented 6 years ago

I think I figured it out:

The function should be written like this:

 await academy.step([               // Let the magic operate ...
        {teacherName: teacher, agentsInput: inputs}
    ]);

Its agentsInput not agentInputs 😄

Pravez commented 6 years ago

Sorry for my mistake :sweat_smile: