0

I have 2 arrays one is mask and the other is the labels:

Both arrays have the same shape:

(Pdb) L.shape
(178, 201, 101)
(Pdb) MASK.shape
(178, 201, 101)

when it reaches to this line:

L[~MASK] = 0 
IndexError: 'index 255 is out of bounds for axis 0 with size 178'

it shows an error that I could not find any reason for that. Could you please help me with this?

1 Answer 1

1

Try:

L[np.logical_not(MASK)]

The ~ (tilde) operator you are using is a bitwise complement operator, not a logical negation operator.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.