Skip to content

Commit

Permalink
chore: remove old optimization in numpy_gemm
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanBredehoft committed Jan 11, 2024
1 parent 1686dd7 commit 663af25
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/concrete/ml/onnx/ops_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,23 +288,7 @@ def numpy_gemm(
b_prime = numpy.transpose(b) if transB else b
c_prime: Union[numpy.ndarray, float] = c if c is not None else 0

# Do
#
# y = processed_alpha * numpy.matmul(a_prime, b_prime) + processed_beta * c_prime
#
# in an efficient way, i.e., to make tracing directly optimized, without expecting any opt from
# the compiler here

y = numpy.matmul(a_prime, b_prime)

if processed_alpha != 1:
y = y * processed_alpha

if numpy.any(c_prime != 0):
if processed_beta == 1:
y = y + c_prime
else:
y = y + processed_beta * c_prime
y = processed_alpha * numpy.matmul(a_prime, b_prime) + processed_beta * c_prime

return (y,)

Expand Down

0 comments on commit 663af25

Please sign in to comment.