Skip to content

Incorrect shape broadcast by BinaryOpNode when broadcasting #429

@arcondello

Description

@arcondello

BinaryOpNode supports broadcasting of not just scalars, but any length-1 array. However this leads to some errors when using high demensional length one arrays. E.g.,

model = Model()
lhs = model.set(10)
rhs = model.constant([[[0]]])
expr = lhs <= rhs

print(expr.shape())

model.states.resize(1)
with model.lock():
    lhs.set_state(0, [0, 1, 2])
    print(expr.state().shape)
(1, 1, -1)
(3, 3, 129)

neither of which are sensible.

Further, because we don't store the shape on the data class we cannot even express the shape correctly in the above example.

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