Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Symbolic indexing requires to cover boolean ndarray and new axis index #18627

@AntiZpvoh

Description

@AntiZpvoh

Description

Symbolic advanced indexing has been implemented in Pull Request #18319 . However, since in symbolic indexing case the index is symbol, we could not determine the dtype of index in Python front-end. Determining dtype must be handled by backend op.

The conditional statement for dtype determining has been implemented as below in PR #18319 (code is in file src/operator/numpy/np_indexing_op.cc). For now, boolean array index case raises an error.

if (inputs[np_indexing_::kIdx].type_flag_ == mshadow::kBool) {
    LOG(FATAL)
    << "Multi-dimension boolean indexing is not supported.";
} else if (inputs[np_indexing_::kIdx].type_flag_ == mshadow::kInt8 ||
             inputs[np_indexing_::kIdx].type_flag_ == mshadow::kInt16 ||
             inputs[np_indexing_::kIdx].type_flag_ == mshadow::kInt32 ||
             inputs[np_indexing_::kIdx].type_flag_ == mshadow::kInt64) {
    ...
} else {
    ...
}

In correct version of symbolic indexing, boolean ndarray index should return corrent value as described in https://numpy.org/doc/stable/user/basics.indexing.html. This feature requires to be implemented.

Also, symbolic indexing should support index as np.newaxis and implicit axis. For now this feature is missing in symbolic indexing and it also requires to be implemented.

References

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions