During my years on Python development, I\'ve always been amazed at how much much much faster things become if you manage to rewrite that code that loops though your ndarray and
In the same spirit of @Julius's answer about deeplearn.js, tensorflow.js is the continuation of the same project. To play around with the tensorflow module in the REPL, I installed it globally (FYI - it is usually advised not to do this) using this:
$ npm install --global @tensorflow/tfjs
Then, I ran $ node
to start the node REPL.
This may differ for you (especially if you decided to install tensorflow locally), but I entered this to reference the tensorflow module:
var tf = require('/usr/local/lib/node_modules/@tensorflow/tfjs')
To create a rank 1 tensor (equivalent to a 1-D array in numpy), try:
var x = tf.tensor( [-3,4] )
And square it with:
x.square().print()
You should get [9,16]
for your output. See https://js.tensorflow.org for more details.
I would say that tensorflow.js is not only a JS replacement for numpy, but also for sklearn, keras, and of course, tensorflow.