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

Function toArray

tfjs-data/src/iterators/lazy_iterator.ts:173–181  ·  view source on GitHub ↗

* Collect all remaining elements of a bounded stream into an array. * Obviously this will succeed only for small streams that fit in memory. * Useful for testing. * * @returns A Promise for an array of stream elements, which will resolve * when the stream is exhausted.

()

Source from the content-addressed store, hash-verified

171 * when the stream is exhausted.
172 */
173 async toArray(): Promise<T[]> {
174 const result: T[] = [];
175 let x = await this.next();
176 while (!x.done) {
177 result.push(x.value);
178 x = await this.next();
179 }
180 return result;
181 }
182
183 /**
184 * Collect all elements of this dataset into an array with prefetching 100

Callers

nothing calls this directly

Calls 2

nextMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…