(
inputOrOutput: string, names: string[], values: TensorOrArrayOrMap)
| 260 | } |
| 261 | |
| 262 | function flattenTensorOrArrayOrMap( |
| 263 | inputOrOutput: string, names: string[], values: TensorOrArrayOrMap) { |
| 264 | if (values instanceof tfc.Tensor) { |
| 265 | return [values]; |
| 266 | } else if (Array.isArray(values)) { |
| 267 | tfc.util.assert( |
| 268 | values.length === names.length, |
| 269 | () => `Received an array of ${values.length} Tensors, but expected ${ |
| 270 | names.length} to match the ${inputOrOutput} keys ${names}.`); |
| 271 | return values; |
| 272 | } else { |
| 273 | const result: tfc.Tensor[] = []; |
| 274 | // Check that all the required keys are available. |
| 275 | for (const name of names) { |
| 276 | if (values[name] == null) { |
| 277 | throw new ValueError( |
| 278 | `The feature data generated by the dataset lacks the required ` + |
| 279 | `${inputOrOutput} key '${name}'.`); |
| 280 | } |
| 281 | result.push(values[name]); |
| 282 | } |
| 283 | return result; |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | function standardizeTensorValidationData<T>( |
| 288 | data: |
no test coverage detected
searching dependent graphs…