Coder Social home page Coder Social logo

Fold (reduce)? about l1 HOT 6 CLOSED

suhr avatar suhr commented on July 22, 2024
Fold (reduce)?

from l1.

Comments (6)

mlajtos avatar mlajtos commented on July 22, 2024

This is something I would love to support the right way, but I am afraid it won't happen. But there will be a +/ operator for Sum and */ for Product.

I have really no idea how to support generalized reductions. :(

4666e21

from l1.

suhr avatar suhr commented on July 22, 2024

Well, that's unfortunate. But what's the problem with generalized reductions?

from l1.

mlajtos avatar mlajtos commented on July 22, 2024

Ok, I might have been quick to judge.

So far, the only problem right now is that scan is not supported by the TF.js. When it will be available, it should not be a problem to implement it.

from l1.

mlajtos avatar mlajtos commented on July 22, 2024

Until tf.scan is available, there will be fake +/ and */ and then I will revisit the reductions in a proper way. So closing for now...

from l1.

mlajtos avatar mlajtos commented on July 22, 2024

::Sum – introduced in be02a2e

I lied. Sum is an unary +, not +/. Same will go for a Product as unary *.

(Originally, I intended unary * as an operator for Sign function, but this is much better.)

from l1.

mlajtos avatar mlajtos commented on July 22, 2024

I read my comment again, and I realized I mixed up reduction and scan... As for cumsum (+\) I have no idea what would be a good notation, or how to support tf.scan in the future. But the question was about the reduction...

I think that prefix notation is not as powerful as reduction notation from APL – one obvious example is -[1 2 3] – but it seems good enough to me.

So, non-commutative binary operators in unary position:
-[1 2 3] = 0 - [1 2 3] – works
/[1 2 3] = 1 / [1 2 3] – works
^[1 2 3] = e ^ [1 2 3] – need work
%[1 2 3] = ??? – no idea, (as postfix it could be (a => a / 100), so prefix in reverse?, or something more useful :))
@[1 2 3] = ??? – no idea

Non-existing (random ideas):
<[1 2 3] = Min [1 2 3] – breaks rule of non-commutative bi-op in un-pos (because it reduces)
>[1 2 3] = Max [1 2 3] – same

from l1.

Related Issues (14)

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.