-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
  • 6,029
  • 8
  • 42
  • 76

1 Answers1

0

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

Alec
  • 8,529
  • 8
  • 37
  • 63