MCPcopy Index your code
hub / github.com/tensorflow/tfjs / toArray

Function toArray

tfjs-data/src/dataset.ts:508–513  ·  view source on GitHub ↗

* Collect all elements of this dataset into an array. * * Obviously this will succeed only for small datasets that fit in memory. * Useful for testing and generally should be avoided if possible. * * ```js * const a = tf.data.array([1, 2, 3, 4, 5, 6]); * console.log(await a.toAr

()

Source from the content-addressed store, hash-verified

506 * @doc {heading: 'Data', subheading: 'Classes'}
507 */
508 async toArray() {
509 if (this.size === Infinity) {
510 throw new Error('Can not convert infinite data stream to array.');
511 }
512 return (await this.iterator()).toArray();
513 }
514
515 /**
516 * Collect all elements of this dataset into an array with prefetching 100

Callers

nothing calls this directly

Calls 2

toArrayMethod · 0.45
iteratorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…