Skip to content

Switch to nan_to_num (rm where) in the future #615

@Saransh-cpp

Description

@Saransh-cpp

#595 adds a workaround for #593's original CuPy issue - cupy/cupy#9143. The workaround includes using where instead of nan_to_num in specific compute functions.

Using where is okay for numerical backends, but it is an issue for the SymPy backend. The shim _lib.where function is not a generic replacement for np.where, instead, it works only for this particular case (return the second argument (first value) as we know that the "normal" values are in the second argument and the "exceptional" ones are in the third argument). Therefore, this occurrence of where is safe to use, but should not be used out of "context" / as a drop-in replacement for np.where. It would be nice to remove the occurrences of where from compute functions (revert #595) once the CuPy issue is fixed (so that the compute functions stay generic).

Metadata

Metadata

Assignees

No one assigned

    Labels

    cleanupNot broken, but could be more streamlined

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions