MCPcopy
hub / github.com/tensorflow/tfjs / getWeightUrls

Method getWeightUrls

tfjs-core/src/io/http.ts:210–232  ·  view source on GitHub ↗
(weightsManifest: WeightsManifestConfig)

Source from the content-addressed store, hash-verified

208 }
209
210 private async getWeightUrls(weightsManifest: WeightsManifestConfig):
211 Promise<string[]> {
212 const weightPath = Array.isArray(this.path) ? this.path[1] : this.path;
213 const [prefix, suffix] = parseUrl(weightPath);
214 const pathPrefix = this.weightPathPrefix || prefix;
215
216 const fetchURLs: string[] = [];
217 const urlPromises: Array<Promise<string>> = [];
218 for (const weightsGroup of weightsManifest) {
219 for (const path of weightsGroup.paths) {
220 if (this.weightUrlConverter != null) {
221 urlPromises.push(this.weightUrlConverter(path));
222 } else {
223 fetchURLs.push(pathPrefix + path + suffix);
224 }
225 }
226 }
227
228 if (this.weightUrlConverter) {
229 fetchURLs.push(...await Promise.all(urlPromises));
230 }
231 return fetchURLs;
232 }
233
234 private async loadWeights(weightsManifest: WeightsManifestConfig):
235 Promise<[WeightsManifestEntry[], WeightData]> {

Callers 2

loadStreamMethod · 0.95
loadWeightsMethod · 0.95

Calls 3

parseUrlFunction · 0.85
allMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected