# Issue "promises" creating a model P5.js and Tensorflow.js

**URL:** <https://discourse.processing.org/t/issue-promises-creating-a-model-p5-js-and-tensorflow-js/12532>\
**Category:** Libraries\
**Created:** [July 5, 2019, 10:13pm UTC](https://discourse.processing.org/t/issue-promises-creating-a-model-p5-js-and-tensorflow-js/12532 "2019-07-05T22:13:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dinda](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/dinda/32/3286_2.png) [@dinda](https://discourse.processing.org/u/dinda)\
**Post date:** [July 5, 2019, 10:13pm UTC](https://discourse.processing.org/t/issue-promises-creating-a-model-p5-js-and-tensorflow-js/12532/1 "2019-07-05T22:13:57Z")

</div>

Hello!!!  
How are you?  
I am trying to fit a model to predict 3 vectors (x, y coordinates) when I show them 28x28px image tensors.  
I’m also doing it in P5.js because I want it to work in the browser.  
The thing is that I have some problems with the promises because they are never displayed in the console.

Is the model.fit function really working?

This is the link  
[https://editor.p5js.org/dinda3650@gmail.com/full/\_WJLAxkt3](https://editor.p5js.org/dinda3650@gmail.com/full/_WJLAxkt3)

Any comments about it will be welcome!  
See you  
DInda.

---

<div class="post-metadata">

**Author:** ![julian2](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/julian2/32/1551_2.png) [@julian2](https://discourse.processing.org/u/julian2)\
**Post date:** [July 7, 2019, 11:37am UTC](https://discourse.processing.org/t/issue-promises-creating-a-model-p5-js-and-tensorflow-js/12532/2 "2019-07-07T11:37:46Z")

</div>

Hi!

currently getting a type mismatch from tensorflow? (is that related?)

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/0/0c9c0459a24a04489583c4a76edcec50cb78b928.png)

---

<div class="post-metadata">

**Author:** ![dinda](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/dinda/32/3286_2.png) [@dinda](https://discourse.processing.org/u/dinda)\
**Post date:** [July 9, 2019, 1:19am UTC](https://discourse.processing.org/t/issue-promises-creating-a-model-p5-js-and-tensorflow-js/12532/3 "2019-07-09T01:19:28Z")

</div>

Hi Julian,  
I made the code again.

[https://editor.p5js.org/dinda3650@gmail.com/full/JoQUpjPAw](https://editor.p5js.org/dinda3650@gmail.com/full/JoQUpjPAw)

This time, the dimensions of the input are correct, but never show me the loss.

Its the same promise problem?

Thanks for your help

DInda

---

<div class="post-metadata">

**Author:** ![dinda](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/dinda/32/3286_2.png) [@dinda](https://discourse.processing.org/u/dinda)\
**Post date:** [July 9, 2019, 1:27am UTC](https://discourse.processing.org/t/issue-promises-creating-a-model-p5-js-and-tensorflow-js/12532/4 "2019-07-09T01:27:14Z")

</div>

Also I realize that Async and await are not working in the sketch.  
[https://editor.p5js.org/dinda3650@gmail.com/full/JoQUpjPAw](https://editor.p5js.org/dinda3650@gmail.com/full/JoQUpjPAw)

u.u
