TensorFlow .js and .py Whats the difference?

Hello! I know how to code TensorFlow.py but my uni is teaching TensorFlow.js is there any to much difference between the two. I dont want to learn .js when I already know .py. Is one better over the other?

So TensorFlow.js has several unique advantages over Python equivalent as it can run on the client side too, not just the server side (via Node) and on the server side it can potentially run faster than Python due to the JIT compiler of JS. Other than that the APIs etc are similar and Python is older so is more mature in terms of development as we are a younger team, but growing fast.

Some links for your consideration:

Check this video for an overview:

Client side benefits - you can not get these server side - unique vs Python:


You can both train and classify data on the client machine without ever sending data to a 3rd party web server. There may be times where this may be a requirement to comply with local laws, such as GDPR for example, or when processing any data that the user may want to keep on their machine and not sent to a 3rd party.


As you are not having to send data to a remote server, inference (the act of classifying the data) can be faster. Even better, you have direct access to the device’s sensors such as the camera, microphone, GPS, accelerometer and more should the user grant you access.

Reach and scale

With one click anyone in the world can click a link you send them, open the web page in their browser, and utilise what you have made. No need for a complex server side Linux setup with CUDA drivers and much more just to use the machine learning system.


No servers means the only thing you need to pay for is a CDN to host your HTML, CSS, JS, and model files. The cost of a CDN is much cheaper than keeping a server (potentially with a graphics card attached) running 24/7.


Which university / professor is teaching TFJS out of curiosity?