python实现relu函数

参考:(28条消息) [python3 Numpy使用技巧]一条语句实现numpy数组relu激活函数_简明AI工作室-CSDN博客_numpy relu

def relu(inin):
    temp = inin > 0   #大于零为真,其余为假
    temp = 1*temp    #真1,假0
    inin = temp * inin
    return inin

  

posted @ 2022-02-24 18:28  李里力离  阅读(784)  评论(0)    收藏  举报