MCPcopy Create free account
hub / github.com/tensorflow/tfjs / columnMajorBatch

Function columnMajorBatch

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

* Groups elements into batches, represented in column-major form. * * We can think of the elements of this iterator as 'rows' (even if they are * nested structures). By the same token, consecutive values for a given * key within the elements form a 'column'. This matches the usual sens

(
      batchSize: number, smallLastBatch = true,
      // tslint:disable-next-line:no-any
      zipFn: (xs: any[]) => DeepMapResult = zipToList)

Source from the content-addressed store, hash-verified

385 * with collections at the leaves.
386 */
387 columnMajorBatch(
388 batchSize: number, smallLastBatch = true,
389 // tslint:disable-next-line:no-any
390 zipFn: (xs: any[]) => DeepMapResult = zipToList):
391 LazyIterator<tf.TensorContainer> {
392 // First collect the desired number of input elements as a row-major batch.
393 const rowBatches = this.rowMajorBatch(batchSize, smallLastBatch);
394 // Now 'rotate' or 'pivot' the data, collecting all values from each column
395 // in the batch (i.e., for each key within the elements) into an array.
396 return rowBatches.map(x => deepZip(x, zipFn));
397 }
398
399 /**
400 * Concatenate this `LazyIterator` with another.

Callers

nothing calls this directly

Calls 1

deepZipFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…