Skip to content

Commit 6234077

Browse files
committed
fix intrinsics evaluation
1 parent 422cf75 commit 6234077

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/store/intrinsics/definitions.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function createUnaryOperator(
2323
evaluate: (input) => {
2424
invariant(input.A[0] && !input.A[1]);
2525
const A = input.A[0];
26-
return A.map((a) => [evaluate(nullthrows(a))]);
26+
return [A.map((a) => evaluate(nullthrows(a)))];
2727
},
2828
});
2929
}
@@ -47,9 +47,11 @@ function createBinaryOperator(
4747
const A = input.A[0];
4848
const B = input.B[0];
4949
invariant(A.length === B.length);
50-
return Array.from({ length: input.A.length }, (_, i) => [
51-
evaluate(nullthrows(A[i]), nullthrows(B[i])),
52-
]);
50+
return [
51+
Array.from({ length: A.length }, (_, i) =>
52+
evaluate(nullthrows(A[i]), nullthrows(B[i])),
53+
),
54+
];
5355
},
5456
});
5557
}
@@ -123,10 +125,11 @@ export const broadcast = new IntrinsicComponentDefinition({
123125
out: { name: "Out", isBitWidthConfigurable: true },
124126
evaluate: (input, outputShape) => {
125127
invariant(input.In[0] && !input.In[1]);
126-
const inputValue = input.In[0];
128+
invariant(input.In[0][0] !== undefined && !input.In[0][1]);
129+
const inputValue = input.In[0][0];
127130
invariant(outputShape[0] && !outputShape[1]);
128131
const outputMultiplicity = outputShape[0].multiplicity;
129-
return Array.from({ length: outputMultiplicity }, () => inputValue);
132+
return [Array.from({ length: outputMultiplicity }, () => inputValue)];
130133
},
131134
});
132135

0 commit comments

Comments
 (0)