简体   繁体   中英

How to plot on browser by using javascript library propel

I want to run official example ( http://propelml.org/ ), but browser console warns:

plot: no output handler.

<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Hello, propel!</title>
  <script src="https://unpkg.com/propel@3.3.1"></script>
</head>
<body>
  <script>
    const { grad, linspace, plot } = propel;

    f = x => x.tanh();
    x = linspace(-4, 4, 200);
    plot(x, f(x),
        x, grad(f)(x),
        x, grad(grad(f))(x),
        x, grad(grad(grad(f)))(x),
        x, grad(grad(grad(grad(f))))(x));
  </script>
</body>
</html>

What is output handler?

在此处输入图片说明

It is just a warning and is coming from here.

One more warning is showing up :

unreachable code after return statement

Read more about it here

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Stmt_after_return

From what I see, the output handler is thing, that allows rendering of a graph, either to a browser window or to NodeJS console?? perhaps. As it says on the webpage: " ... In the browser it utilizes WebGL through deeplearn.js and on Node it uses TensorFlow's C API."

So wanna make a fancy graph? I guess you would need to dig more into coding

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM