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

Function convertToTensorArray

tfjs-core/src/tensor_util_env.ts:133–145  ·  view source on GitHub ↗
(
    arg: Array<T|TensorLike>, argName: string, functionName: string,
    parseAsDtype: DataType|'numeric'|'string_or_numeric' = 'numeric')

Source from the content-addressed store, hash-verified

131}
132
133export function convertToTensorArray<T extends Tensor>(
134 arg: Array<T|TensorLike>, argName: string, functionName: string,
135 parseAsDtype: DataType|'numeric'|'string_or_numeric' = 'numeric'): T[] {
136 if (!Array.isArray(arg)) {
137 throw new Error(
138 `Argument ${argName} passed to ${functionName} must be a ` +
139 '`Tensor[]` or `TensorLike[]`');
140 }
141 const tensors = arg as T[];
142 return tensors.map(
143 (t, i) =>
144 convertToTensor(t, `${argName}[${i}]`, functionName, parseAsDtype));
145}

Callers 4

gradsFunction · 0.90
stack_Function · 0.90
multiRNNCell_Function · 0.90
concat_Function · 0.90

Calls 1

convertToTensorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…