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

Function fetchFunc

tfjs-data/src/iterators/url_chunk_iterator_test.ts:24–37  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

22
23describe('URLChunkIterator', () => {
24 const fetchFunc = (path: string) => {
25 const buf = new ArrayBuffer(TEST_STRING.length);
26 const bufView = new Uint8Array(buf);
27 for (let i = 0, strLen = TEST_STRING.length; i < strLen; i++) {
28 bufView[i] = TEST_STRING.charCodeAt(i);
29 }
30
31 return {
32 ok: true,
33 arrayBuffer: async () => {
34 return buf;
35 }
36 };
37 };
38
39 it('Reads the entire file and then closes the stream', async () => {
40 const readIterator = await urlChunkIterator('', {chunkSize: 10}, fetchFunc);

Callers 2

loadWeightsAsArrayBufferFunction · 0.85
streamWeightsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…