MCPcopy Create free account
hub / github.com/tensorflow/tfjs / downloadLibtensorflow

Function downloadLibtensorflow

tfjs-node/scripts/install.js:138–166  ·  view source on GitHub ↗

* Downloads libtensorflow and notifies via a callback when unpacked.

(callback)

Source from the content-addressed store, hash-verified

136 * Downloads libtensorflow and notifies via a callback when unpacked.
137 */
138async function downloadLibtensorflow(callback) {
139 // Ensure dependencies staged directory is available:
140 await ensureDir(depsPath);
141
142 console.warn('* Downloading libtensorflow');
143 console.log(getPlatformLibtensorflowUri());
144 resources.downloadAndUnpackResource(
145 getPlatformLibtensorflowUri(), depsPath, async () => {
146 if (platform === 'win32') {
147 // Some windows libtensorflow zip files are missing structure and the
148 // eager headers. Check, restructure, and download resources as
149 // needed.
150 if (!await exists(depsLibTensorFlowPath)) {
151 // Verify that tensorflow.dll exists
152 const libtensorflowDll = path.join(depsPath, 'tensorflow.dll');
153 if (!await exists(libtensorflowDll)) {
154 throw new Error('Could not find libtensorflow.dll');
155 }
156
157 await ensureDir(depsLibPath);
158 await rename(libtensorflowDll, depsLibTensorFlowPath);
159 }
160 }
161 // No other work is required on other platforms.
162 if (callback !== undefined) {
163 callback();
164 }
165 });
166}
167
168/**
169 * Calls node-gyp for Node.js Tensorflow binding after lib is downloaded.

Callers 1

runFunction · 0.85

Calls 4

ensureDirFunction · 0.85
joinMethod · 0.80
logMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…