Skip to content

Checking if NDArray is null returns wrong results #935

Closed
@Superpiffer

Description

@Superpiffer

If I try to check if an NDArray is null, I get strange behavior:

NDArray n = null;
bool b1 = n is null;  // TRUE
bool b2 = n == null;  // FALSE!

I saw in NDArray.Operators.cs that if the second value is null, the result is false:

public static NDArray operator ==(NDArray lhs, NDArray rhs)
=> rhs is null ? Scalar(false) : new NDArray(math_ops.equal(lhs, rhs));

Is that a wanted behavior? I think that if both values are null, the result should be true.

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