SciSharp / NumSharp

High Performance Computation for N-D Tensors in .NET, similar API to NumPy.
https://github.com/SciSharp
Apache License 2.0
1.34k stars 187 forks source link

Different Result between NumPy and NumSharp with np.matmul Function #477

Open Koyamin opened 2 years ago

Koyamin commented 2 years ago

I am a new learner of NumSharp and now I want to calculate the matmul product of two NDArrays by using np.matmul function:

using NumSharp;

var a = np.arange(2 * 2 * 3).reshape((2, 2, 3));
var b = np.array(new double[] { 1, 2, 3 });
var res = np.matmul(a, b);

The value of res is as follow:

[[6],  [24]]

However I have tried the same code in Python:

import numpy as np

a = np.arange(2*2*3).reshape((2,2,3))
b = np.array([1,2,3])
res = np.matmul(a, b)

Now the value of res is

[[ 8 26]
 [44 62]]

I have no idea about it. I want to get the result in Python, what should I do?

ChengYen-Tang commented 1 year ago

這個專案好像已經沒有在維護了,我有發現一個更完善的專案 https://github.com/Quansight-Labs/numpy.net