(
weightsManifest: tf.io.WeightsManifestConfig,
path: string)
| 182 | } |
| 183 | |
| 184 | private async loadWeights( |
| 185 | weightsManifest: tf.io.WeightsManifestConfig, |
| 186 | path: string): Promise<[tf.io.WeightsManifestEntry[], ArrayBuffer]> { |
| 187 | const dirName = dirname(path); |
| 188 | const buffers: Buffer[] = []; |
| 189 | const weightSpecs: tf.io.WeightsManifestEntry[] = []; |
| 190 | for (const group of weightsManifest) { |
| 191 | for (const path of group.paths) { |
| 192 | const weightFilePath = join(dirName, path); |
| 193 | const buffer = await readFile(weightFilePath) |
| 194 | .catch(doesNotExistHandler('Weight file')); |
| 195 | buffers.push(buffer); |
| 196 | } |
| 197 | weightSpecs.push(...group.weights); |
| 198 | } |
| 199 | return [weightSpecs, toArrayBuffer(buffers)]; |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * For each item in `this.path`, creates a directory at the path or verify |
no test coverage detected