* Maps this dataset through an async 1-to-1 transform. * * ```js * const a = * tf.data.array([1, 2, 3]).mapAsync(x => new Promise(function(resolve){ * setTimeout(() => { * resolve(x * x); * }, Math.random()*1000 + 500); * })); * console.log(await a.toArray());
(transform: (value: T) => Promise<O>)
| 293 | * @doc {heading: 'Data', subheading: 'Classes'} |
| 294 | */ |
| 295 | mapAsync<O extends tf.TensorContainer>(transform: (value: T) => Promise<O>): |
| 296 | Dataset<O> { |
| 297 | const base = this; |
| 298 | return datasetFromIteratorFn(async () => { |
| 299 | return (await base.iterator()).mapAsync(transform); |
| 300 | }, this.size); |
| 301 | } |
| 302 | |
| 303 | /** |
| 304 | * Creates a `Dataset` that prefetches elements from this dataset. |
nothing calls this directly
no test coverage detected
searching dependent graphs…