Giter VIP home page Giter VIP logo

Comments (12)

henon avatar henon commented on August 11, 2024 1

I'll remove split and matmul members and for all others that should not be there I leave it up to users to find out and remove on demand when reported. It is kinda dangerous to remove all which are not listed on that page, maybe some do work and are not documented. Who knows.

from numpy.net.

henon avatar henon commented on August 11, 2024 1

yes, that is also a good idea

from numpy.net.

henon avatar henon commented on August 11, 2024

I'll add the overload for you

from numpy.net.

henon avatar henon commented on August 11, 2024

this test proves it works now:

        [TestMethod]
        public async Task IssueByMartinDevans()
        {
            //>>> x = np.arange(9)
            //>>> np.split(x, 3)
            //[array([0, 1, 2]), array([3, 4, 5]), array([6, 7, 8])]
            var x = np.arange(9);
            var b = np.split(x, 3).repr();
            var a = "(array([0, 1, 2]), array([3, 4, 5]), array([6, 7, 8]))";
            Assert.AreEqual(a, b);
            //>>> x = np.arange(8.0)
            //>>> np.split(x, [3, 5, 6, 10])
            //[array([0., 1., 2.]),
            //array([3., 4.]),
            //array([5.]),
            //array([6., 7.]),
            //array([], dtype = float64)]
            x = np.arange(8);
            b = np.split(x, new[] { 3, 5, 6, 10 }).repr();
            a = "(array([0, 1, 2]), array([3, 4]), array([5]), array([6, 7]), array([], dtype=int32))";
            Assert.AreEqual(a, b);
        }

Update on Nuget: https://www.nuget.org/packages/Numpy/3.11.1.32

from numpy.net.

martindevans avatar martindevans commented on August 11, 2024

Wow! Thanks for the incredibly fast fix, very much appreciated ❤️

from numpy.net.

martindevans avatar martindevans commented on August 11, 2024

Unfortunately calling x.split(3, axis:-1) caused this error:

Python.Runtime.PythonException: ''numpy.ndarray' object has no attribute 'split''

Using np.split(x, 3, axis: -1); is fine though.

from numpy.net.

henon avatar henon commented on August 11, 2024

Unfortunately calling x.split(3, axis:-1) caused this error:

Python.Runtime.PythonException: ''numpy.ndarray' object has no attribute 'split''

Can you show the code how you come by that x which you call split on ?

from numpy.net.

martindevans avatar martindevans commented on August 11, 2024

Even something as simple as this triggers it for me:

NDarray x = np.array(new[] { 1, 2, 3 });
x.split(3, axis: -1);

While working with other things I noticed this causes a similar error:

NDarray x = np.array(new[] { 1, 2, 3 });
x.matmul(x);

Python.Runtime.PythonException: ''numpy.ndarray' object has no attribute 'matmul''

So this may be a broader issue of NDarray.whatever methods vs np.whatever helpers?

from numpy.net.

martindevans avatar martindevans commented on August 11, 2024

I don't know if it's relevant, but I do have this somewhat cryptic message in the log:

Could not find platform dependent libraries <exec_prefix>

from numpy.net.

henon avatar henon commented on August 11, 2024

So this may be a broader issue of NDarray.whatever methods vs np.whatever helpers?

Yes, you are right, if you look here, not all methods are defined on NDArray: https://numpy.org/doc/stable/reference/arrays.ndarray.html#array-methods

I obviously made a wrong assumption here by generating all methods as static functions of np as well as members of NDarray. Looks like the members should only be generated for the supported ones.

from numpy.net.

martindevans avatar martindevans commented on August 11, 2024

Is it worth generating all of the np.whatever methods as static extension methods? That way you get member-like calls for free.

from numpy.net.

henon avatar henon commented on August 11, 2024

You can try it in https://www.nuget.org/packages/Numpy/3.11.1.33 once it is online.

from numpy.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.