There are two ways we can set up the TensorFlow.js environment:
- Use the minified JavaScript code that's distributed in the CDN
- Use the bundled package that's distributed by package managers such as npm
Typically, TensorFlow.js should be used on a web platform. Since the prebuilt file is distributed by the global content distribution network (CDN) service, we need to add a script tag to the web application:
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs/dist/tf.min.js"></script>
TensorFlow.js' classes can be found under the tf namespace. The CDN service works fast and is stable enough to provide such static resources to users. This is the easiest way to use TensorFlow.js.
If you want to serve your application in an environment where a public network isn't available, then you need to import TensorFlow...