ReLU激活函数,也称为线性整流函数,是rectifiedlinearunit(Relu )的缩写。
importnumpyasnpimportmatplotlib.pyplotasplotdefrelu (x ) :returnNP.maximum(0,x ) if__name_=='__ ) ) 0.1 ) b=relu(a ) plot.plot(a,b,label='ReLU ',color='red ' ) plot.legend ) (plot.grid ) ) plot.show