摘要: ![](https://img2020.cnblogs.com/blog/2126973/202012/2126973-20201223215424769-1708199656.png) 阅读全文
posted @ 2020-12-23 21:55 吴莫愁258 阅读(42) 评论(0) 推荐(0) 编辑
摘要: ![](https://img2020.cnblogs.com/blog/2126973/202012/2126973-20201223215212994-878815278.png) 阅读全文
posted @ 2020-12-23 21:54 吴莫愁258 阅读(90) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf import numpy as np "tf.where(),条件语句,真返回a" a = tf.constant([1, 2, 3, 1, 1]) b = tf.constant([0, 1, 3, 4, 5]) c = tf.where(tf.gr 阅读全文
posted @ 2020-12-23 21:47 吴莫愁258 阅读(61) 评论(0) 推荐(0) 编辑
摘要: "求沿指定维度的平均值、和(axis=1沿行向量方向)" x = tf.constant([[1, 2, 3], [2, 2, 3]]) print("x:", x) print("mean of x:", tf.reduce_mean(x)) # 求x中所有数的均值 print("sum of x 阅读全文
posted @ 2020-12-23 19:09 吴莫愁258 阅读(100) 评论(0) 推荐(0) 编辑
摘要: "将Numpy数组转换为张量" a = np.arange(0,5) print("数组a:",a) b = tf.convert_to_tensor(a,dtype=tf.int64) print("张量b:",b) "创建全为0的张量" zero_Tensor = tf.zeros([2,3]) 阅读全文
posted @ 2020-12-23 19:04 吴莫愁258 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 梯度带tf.GradientTape(自动求梯度) Tensorflow 会把 'tf.GradientTape' 上下文中执行的所有操作都记录在一个磁带上 ("tape")。 然后基于这个磁带和每次操作产生的导数,用反向微分法("reverse mode differentiation")来计算这 阅读全文
posted @ 2020-12-23 16:35 吴莫愁258 阅读(159) 评论(0) 推荐(0) 编辑