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

Function getTensor

tfjs-data/src/iterators/microphone_iterator_test.ts:191–208  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

189 * tensor returned from 3rd call, timesRun:3, tensorsReturned:3.
190 */
191 const getTensor = async () => {
192 // Clear the interval after it ran 3 times.
193 if (timesRun === 3) {
194 clearInterval(interval);
195 } else {
196 timesRun++;
197 expect(tensorsReturned).toBe(0);
198 const result = await microphoneIterator.next();
199 tensorsReturned++;
200 // When the first tensor got returned (~464ms), getTensor() function
201 // should have been called 3 times (at 400ms).
202 expect(timesRun).toBe(3);
203 expect(result.done).toBeFalsy();
204
205 const value = result.value;
206 expect(value.spectrogram.shape).toEqual([10, 10, 1]);
207 }
208 };
209
210 // Call iterator.next() every 200 milliseconds, stop after 3 times.
211 const interval = setInterval(getTensor, 1);

Callers

nothing calls this directly

Calls 1

nextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…