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

Function singletonOrArray

tfjs-layers/src/utils/generic_utils.ts:63–68  ·  view source on GitHub ↗
(xs: T[])

Source from the content-addressed store, hash-verified

61 * @param tensors
62 */
63export function singletonOrArray<T>(xs: T[]): T|T[] {
64 if (xs.length === 1) {
65 return xs[0];
66 }
67 return xs;
68}
69
70/**
71 * Normalizes a list/tensor into a list.

Callers 4

evaluateMethod · 0.90
predictLoopMethod · 0.90
trainOnBatchMethod · 0.90
evaluateDatasetFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…