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

Function generator

tfjs-data/src/readers.ts:199–206  ·  view source on GitHub ↗
(
  generator: () => Iterator<T> | Promise<Iterator<T>> | AsyncIterator<T>,
)

Source from the content-addressed store, hash-verified

197 * }
198 */
199export function generator<T extends TensorContainer>(
200 generator: () => Iterator<T> | Promise<Iterator<T>> | AsyncIterator<T>,
201): Dataset<T> {
202 return datasetFromIteratorFn(async () => {
203 const gen = await generator();
204 return iteratorFromFunction(() => gen.next());
205 });
206}
207
208/**
209 * Create an iterator that generates `Tensor`s from webcam video stream. This

Callers

nothing calls this directly

Calls 3

datasetFromIteratorFnFunction · 0.90
iteratorFromFunctionFunction · 0.90
nextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…