In theano, I have a vector with values around 0 and using switch, I set every value smaller than 0 to 0:
T.switch(x < 0, 0, x)
How do I the same thing using numpy?
Answer to question of numpy
analogue of switch
numpy.where(x < 0, 0, x)
But specially for this task I prefer using function that was created for this purpose
x.clip(0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With