scripting
This commit is contained in:
@@ -69,9 +69,7 @@ export async function runInference(
|
||||
*/
|
||||
export function validateInput(tensor: Float32Array): void {
|
||||
if (!(tensor instanceof Float32Array)) {
|
||||
throw new Error(
|
||||
`Expected Float32Array input, got ${typeof tensor}`,
|
||||
);
|
||||
throw new Error(`Expected Float32Array input, got ${typeof tensor}`);
|
||||
}
|
||||
|
||||
if (tensor.length !== INPUT_SIZE) {
|
||||
@@ -84,9 +82,7 @@ export function validateInput(tensor: Float32Array): void {
|
||||
// Check for NaN/Infinity values
|
||||
for (let i = 0; i < tensor.length; i++) {
|
||||
if (!Number.isFinite(tensor[i])) {
|
||||
throw new Error(
|
||||
`Tensor contains non-finite value at index ${i}: ${tensor[i]}`,
|
||||
);
|
||||
throw new Error(`Tensor contains non-finite value at index ${i}: ${tensor[i]}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user