曲线图如下:
实现方法:
import tensorflow as tf import matplotlib.pyplot as plt import numpy as np #定义x的取值范围 x = np.linspace(-10,10,100) #直接使用tensorflow实现 y = tf.nn.sigmoid(x) #绘图 plt.plot(x,y) plt.grid() plt.show()
实现方法:
import tensorflow as tf import matplotlib.pyplot as plt import numpy as np #定义x的取值范围 x = np.linspace(-10,10,100) #直接使用tensorflow实现 y = tf.nn.tanh(x) #绘图 plt.plot(x,y) plt.grid() plt.show()
实现方法:
import tensorflow as tf import matplotlib.pyplot as plt import numpy as np #定义x的取值范围 x = np.linspace(-10,10,100) #直接使用tensorflow实现 y = tf.nn.relu(x) #绘图 plt.plot(x,y) plt.grid() plt.show()
实现方法:
import tensorflow as tf import matplotlib.pyplot as plt import numpy as np #定义x的取值范围 x = np.linspace(-10,10,100) #直接使用tensorflow实现 y = tf.nn.leaky_relu(x) #绘图 plt.plot(x,y) plt.grid() plt.show()
实现方法:
import tensorflow as tf import matplotlib.pyplot as plt x = tf.constant([0.2,0.02,0.15,1.3,0.5,0.06,1.1,0.05,3.75]) y = tf.nn.softmax(x) plt.plot(x,y) plt.grid() plt.show()