MikeInnes / DataFlow.jl

Other
122 stars 12 forks source link

Can't return a tuple with at-flow #12

Closed jpsamaroo closed 6 years ago

jpsamaroo commented 6 years ago

Slightly-modified example from the README:

julia> @flow function recurrent(x, t)
         hidden = σ( Wxh*x + Whh*hidden )
         y = σ( Why*hidden + Wxy*x )
         return (y, t)
       end
DVertex((y, t))

Returning either y or t separately works just fine, of course.

This is happening on the master branch of DataFlow with Julia 0.6.2

MikeInnes commented 6 years ago

Not sure exactly why this happens, but FWIW you can use an anonymous function expression to get the right thing:

@flow function (x, t)
                return (x, t)
              end
jpsamaroo commented 6 years ago

While that example does work, trying the same thing on my original example now throws a different error:

julia> @flow function (x, t)
                hidden = σ( Wxh*x + Whh*hidden )
                y = σ( Why*hidden + Wxy*x )
                return (y, t)
              end
ERROR: UndefVarError: σ not defined
MikeInnes commented 6 years ago

The readme is just really old, and the package has changed quite a lot, so that stuff wasn't maintained. I've updated things to be more consistent (and fixed the readme as well).