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 188 forks source link

Performance on np.matmul #427

Open Banyc opened 3 years ago

Banyc commented 3 years ago

The shape of x is [200, 1000], of w is [1000, 500], and of b is [500]

b is filled with zeros, x and w are random float64/double.

Example code of NumSharp:

var out = np.matmul(x, w) + b;

... takes 3-4 seconds.

Example code of numpy:

out = x @ w + b

... finishes immediately.

Oceania2018 commented 3 years ago

@Banyc Can you test it in TensorFlow.NET eager mode?

Banyc commented 3 years ago

I use only this package to implement neural network layers from the stretch, without using other packages like Tensorflow.NET.

Oceania2018 commented 3 years ago

It will have performance issue. Should use other more mature package.