Skip to content

BUG in array assignment #1677

Closed
Closed

Description

@vakopian

The following code should work, but throws an exception:

    dim_t sz = 1;
    array a = constant(1.0f, 3, sz, f32);
    array b = constant(2.0f, 3, sz, f32);
    array cond = constant(0, sz, b8); // all false
    a(span, cond) = b(span, cond);

It results in

terminate called after throwing an instance of 'af::exception'
  what():  ArrayFire Exception (Invalid input size:203):
In function void assign(cuda::Array<T>&, const unsigned int&, const af_seq*, const cuda::Array<outType>&) [with Tout = float; Tin = float; af_seq = af_seq]
In file src/api/c/assign.cpp:70
Size mismatch between input and output

In function af::array::array_proxy& af::array::array_proxy::operator=(const af::array&)
In file src/api/cpp/array.cpp:498

This seems to be a very corner case: Using sz bigger than 1 works fine. Keeping sz = 1, but using a condition that's not all false also works fine (e.g. using cond = constant(1, sz, b8)). I know empty array handling is pretty new (from #1533), so perhaps there is still an issue handling this case.

Activity

  1. added this to the v3.4.2 milestone on Dec 16, 2016
  2. modified the milestones: v3.5.0, v3.4.2 on Dec 19, 2016
  3. modified the milestones: v3.5.1, v3.5.0 on May 22, 2017
  4. pavanky commented on Aug 2, 2017

    @pavanky
    Member

    Fixed in hotfixes-3.5.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions