接触,学习,使用
一
tf是机器学习开源的模块,主要有三部分,第一部分基本数据,常量,变量,占位符。第二部分是函数,relu,conv2d等函数,第三部分是执行,变量初始化,
二,
函数
import tensorflow as tf
sess=tf.Session()
# tf.nn.relu()函数是将大于0的数保持不变,小于0的数置为0
a = tf.constant([-1.0,10.8,0.9, 2.0])
b = tf.nn.relu(a)
print(sess.run(b))
#tf.nn.conv2d 卷积
input = tf.random_normal([1,3,3,5])
filter = tf.random_normal([1,1,5,1])
op = tf.nn.conv2d(input, filter, strides=[1, 1, 1, 1], padding='VALID')
print(sess.run(op))
#tf.nn.softmax所占比率
a = tf.constant([-1.0,10.8,0.9, 2.0])
d=tf.nn.softmax(a)
print(sess.run(d))