-2
In [20]: def relu(x): 
    ...:     return (x>0) * x 
    ...:                         

Is that because in Python, True is interpreted as 1 while False as 0 implicitly?

marlon
  • 4,279
  • 6
  • 29
  • 49

1 Answers1

0

False is just a keyword that means int equal to 0. Same for True and 1.

Alec
  • 7,110
  • 7
  • 28
  • 53