MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / flatMap

Function flatMap

intent-classifier/training/util.js:34–43  ·  view source on GitHub ↗
(array, func)

Source from the content-addressed store, hash-verified

32}
33
34function flatMap(array, func) {
35 const result = [];
36 for (const el of array) {
37 const mapped = func(el);
38 for (const innerEl of mapped) {
39 result.push(innerEl);
40 }
41 }
42 return result;
43}
44
45function chunk(array, chunkSize) {
46 const result = [];

Callers 1

embedTokensFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected