摘要: Example: import tensorflow as tf # 创建 4 个张量,并赋值 a = tf.constant(1.) b = tf.constant(2.) c = tf.constant(3.) w = tf.constant(4.) with tf.GradientTape() 阅读全文
posted @ 2022-02-26 16:24 多发Paper哈 阅读(87) 评论(0) 推荐(0) 编辑
摘要: tf.data.Dataset.from_tensor_slices 该函数是dataset核心函数之一,它的作用是把给定的元组、列表和张量等数据进行特征切片。切片的范围是从最外层维度开始的。如果有多个特征进行组合,那么一次切片是把每个组合的最外维度的数据切开,分成一组一组的。 假设我们现在有两组数 阅读全文
posted @ 2022-02-26 11:39 多发Paper哈 阅读(577) 评论(0) 推荐(1) 编辑
摘要: #将python的数据类型(列表和矩阵)转换成TensorFlow可用的tensor数据类型 import tensorflow as tf import numpy as np A = [1,2,3] B = np.array([1,2,3]) C = tf.convert_to_tensor(A 阅读全文
posted @ 2022-02-26 11:30 多发Paper哈 阅读(534) 评论(0) 推荐(0) 编辑
摘要: 1、numpy 乘法运算中 "*" 是数组元素逐个计算具体代码如下: a = np.array([[1,2],[3,4]]) b = np.array([[1,2],[3,4]]) print(a) print(b) print(a*b) """ [[1 2] [3 4]] [[1 2] [3 4] 阅读全文
posted @ 2022-02-26 11:10 多发Paper哈 阅读(356) 评论(0) 推荐(0) 编辑
摘要: 计算代码时间 timeit.timeit(stmt='pass', setup='pass', timer=, number=1000000, globals=None) 创建一个Timer实例,并运行代码进行计时,默认将代码执行一百万次。 stmt是要执行的代码,字符串形式,多行就多个字符串。se 阅读全文
posted @ 2022-02-26 00:53 多发Paper哈 阅读(327) 评论(0) 推荐(0) 编辑
Live2D