MCPcopy
hub / github.com/determined-ai/determined / tryOnSamples

Function tryOnSamples

webui/react/src/services/decoder.test.ts:9–26  ·  view source on GitHub ↗
(samples: T[], fn: (sample: T) => void)

Source from the content-addressed store, hash-verified

7type FailReport<T = unknown> = { error: Error; sample: T };
8
9const tryOnSamples = <T = unknown>(samples: T[], fn: (sample: T) => void): FailReport[] => {
10 const fails: FailReport[] = [];
11 samples.forEach((sample) => {
12 try {
13 fn(sample);
14 } catch (e) {
15 fails.push({ error: e as Error, sample });
16 }
17 });
18 if (fails.length > 0) {
19 const { sample, error } = fails.last();
20 /* eslint-disable no-console */
21 console.error(error);
22 console.log('Sample:', sample);
23 /* eslint-enable no-console */
24 }
25 return fails;
26};
27
28describe('Decoder', () => {
29 it('Should decode seeded hyperparameters', () => {

Callers 1

decoder.test.tsFile · 0.85

Calls 5

logMethod · 0.80
lastMethod · 0.65
errorMethod · 0.65
forEachMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected