Skip to content

Behavior on vcat of scalars #172

Open
@gdalle

Description

@gdalle

Here's an inconsistency I discovered based on two ways of constructing vectors from floats:

julia> using Tracker

julia> f1(x) = [x, x];

julia> f2(x) = vcat(x, x);

julia> x = 1.0;

julia> dy = ones(2);

julia> y1, pb1 = Tracker.forward(f1, x);

julia> y2, pb2 = Tracker.forward(f2, x);

julia> y1 == y2
true

julia> pb1(dy) == pb2(dy)
false

julia> pb1(dy)  # returns a scalar
(2.0,)

julia> pb2(dy)  # returns an array
([2.0],)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions