![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
HXKait
这个作者很懒,什么都没留下…
展开
-
pytorc保存及加载模型参数方法
pytorch保存模型、参数的方法 方法一:只保存模型的参数 device = torch.device('cuda' if torch.cuda.is_available() else 'cpu' ) filepath = 'model.dat' # 保存参数 torch.save(model.state_dict(), filepath) # 加载模型参数 , map_location: 把数据加载到哪个device(GPU或CPU) model.load_stat原创 2021-11-11 17:45:20 · 1546 阅读 · 0 评论 -
tensorflow.reduce_函数学习
@tensorflow.reduce_函数 tensorflow.reduce_sum() reduce_sum函数的计算和指定维度的顺序无关 a = np.random.randint(1, 9, size=(2,3,4)) print(a) b1 = tf.reduce_sum(tf.convert_to_tensor(value=a),axis=[2,1],keepdims=True) print(b1) b2 = tf.reduce_sum(tf.convert_to_tensor(value原创 2021-11-02 16:24:17 · 175 阅读 · 0 评论