Giter Club home page Giter Club logo

Comments (10)

jcmgray avatar jcmgray commented on June 17, 2024 3

I think there are maybe two questions here:

  • implicit output: einsum('ab', x) - i.e. the output is not given but automatically computed, this is handled already
  • interleaved format: einsum(array_0, indices_0, array_1, indices_1, ...[, output_indices]), this is not supported yet, but is just a matter of parsing that could be lifted from e.g. opt_einsum.

Note that einsum('ab->ab, v1, v2) is not actually valid! There should only be one term, and that last call should probably error, as it does with numpy...

from sparse.

HadrienNU avatar HadrienNU commented on June 17, 2024 2

Actually, since #579 your case is working and the interleaved format is supported. However, you need to update sparse to the last development version from github.

from sparse.

jcmgray avatar jcmgray commented on June 17, 2024 1

By the way, you could use opt_einsum.contract as a drop in here and it should work with sparse, handle the input and also perform contraction order (for 3+ terms) optimization.

from sparse.

hameerabbasi avatar hameerabbasi commented on June 17, 2024

Cc @HadrienNU @jcmgray

from sparse.

hameerabbasi avatar hameerabbasi commented on June 17, 2024

I believe it isn't possible, as of now. Is it required for your use-case?

from sparse.

kumgleb avatar kumgleb commented on June 17, 2024

@hameerabbasi
Yes, I'm trying to use it for the sparse factor product in MRF, and most convenient way is to provide only operands and indices, here is the example in numpy:
https://github.com/pgmpy/pgmpy/blob/d1131144af2a2a4b3ef341613170538c808194aa/pgmpy/factors/discrete/DiscreteFactor.py#L704

I trying to implement the same, but with sparse matrices.

from sparse.

kumgleb avatar kumgleb commented on June 17, 2024

Yeah, it seems that convert_interleaved_input function from opt_einsum may help to solve the problem.
@jcmgray @hameerabbasi big thanks to you guys for a quick response!

from sparse.

kumgleb avatar kumgleb commented on June 17, 2024

@HadrienNU thanks for a reply, already manage to do it with parsing from opt_einsum, but using it from the lib will be more convenient.

from sparse.

jcmgray avatar jcmgray commented on June 17, 2024

Actually, since #579 your case is working and the interleaved format is supported. However, you need to update sparse to the last development version from github.

Ah sorry I missed this PR, thanks for adding the additional parsing!

from sparse.

hameerabbasi avatar hameerabbasi commented on June 17, 2024

Since the question has been answered and the required feature is in master, I'm going to close this issue.

from sparse.

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.