* Downloads libtensorflow and notifies via a callback when unpacked.
(callback)
| 136 | * Downloads libtensorflow and notifies via a callback when unpacked. |
| 137 | */ |
| 138 | async 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. |
no test coverage detected
searching dependent graphs…