Skip to content

Panic on SubAssign with same dimensions #110

Closed
@AtheMathmo

Description

@AtheMathmo

I've been trying to get a simple example working with the OpAssign traits but it seems that there is a bug there.

This code compiles and runs fine:

fn main() {
    af::set_backend(raf::Backend::CPU);

    let mut a = Array::new(&[1.0,1.0,1.0], Dim4::new(&[3,1,1,1]));
    let b = Array::new(&[1.0,2.0,1.0], Dim4::new(&[3,1,1,1]));

    a = a - b;
}

However if I switch to the SubAssign trait:

fn main() {
    raf::set_backend(raf::Backend::CPU);

    let mut a = Array::new(&[1.0,1.0,1.0], Dim4::new(&[3,1,1,1]));
    let b = Array::new(&[1.0,2.0,1.0], Dim4::new(&[3,1,1,1]));

    a -= b;
}

I get the following runtime error: thread 'main' panicked at 'Error message: Size is incorrect'. This message persists even if I replace b with a.clone().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions