Skip to content

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

Description

@Koyamin

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions