Reputation: 47
I am in the process of publishing a Firefox extension that includes a copy of the minified tensorflow.js library. In Mozilla's Third Party Library Usage guidelines, the following is stated:
You should download third-party libraries from their official site, not from a CDN or other location. This point is important.
It therefore seems that I am not allowed to use the download URL I see being used in every tf.js project, since it serves the library through a CDN.
I have been looking through the Tensorflow.js repository at Github, trying to find a "releases" directory or similar from where to download a specific version of tf.min.js, but I have been unable to find anything like that.
Where could I find an official, stable direct download link to a given version of tf.min.js which is not served by a CDN?
Upvotes: 1
Views: 1028
Reputation: 1794
You will not find the tf.min.js
file in the GitHub repo because TensorFlow.js is written in TypeScript. The JavaScript files are only generated at build time and not committed to the repo.
The official TensorFlow.js website does not offer direct downloads but does offer a second option in addition to using a CDN: you can download any given release of TensorFlow.js via npm.
The main package in npm is @tensorflow/tfjs. You can install in a project in the usual way with npm install @tensorflow/tfjs
, or alternatively if you just want a full copy of the package source without using the node_modules
directory, you can run the following:
npm pack @tensorflow/tfjs
This will give you a tarball file like tensorflow-tfjs-1.7.0.tgz
. You can unpack this with:
tar -xf tensorflow-tfjs-1.7.0.tgz
Now you'll find tf.min.js
within package/dist
. You'll also find a non-minified tf.js
.
As it happens, the tf.min.js
file is precisely the same as the one on the CDN (the hashes match). However, using an npm release does provide a reliable method for fetching a precise version from an official source, so these instructions may better satisfy the review process.
Upvotes: 3