import cv2 import numpy import os img = numpy.zeros((3, 3), dtype=numpy.uint8) print(img) img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR) print(img) print ...
分类:
其他好文 时间:
2019-11-17 21:09:09
阅读次数:
85
防止内存泄露 子类继承父类后,在子类构造函数里,通过new 来生成一个对象实例 在析构函数里执行释放内存操作,如果父类不加上virtual 关键词 则子类执行的是父类的析构函数,不执行自己的析构函数。 父类不加virtual 子类继承后,并执行析构函数: 输出结果: 父类加上virtual关键词后, ...
分类:
编程语言 时间:
2019-11-16 23:36:27
阅读次数:
93
1、先以二维数组为例:此数组为二维数组,shape=[4,3],第一个维度为4,第二个维度为3在numpy中若没有指定axis,默认对所有的数据相加axis=0表示第一个维度,axis=1表示第二个维度,以此类推(是几维数组就有几个维度)若指定了axis=0,则沿着第一个维度的方向进行计算此例中,第... ...
分类:
其他好文 时间:
2019-11-14 11:20:53
阅读次数:
254
先将模块导入文件中 import numpy as np 1、使用shape属性修改数组的形状 arr.shape = (4, 4) arr.shape = 4, 4 arr.shape = [4, 4] 使用shape属性修改原数组形状的方法有以上三种,只要元素个数相同,可以随意更改数组的形状 2 ...
分类:
编程语言 时间:
2019-11-11 00:49:22
阅读次数:
170
Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint the path from his house to the gate. The pa ...
分类:
其他好文 时间:
2019-11-10 11:44:17
阅读次数:
73
原文链接:https://blog.csdn.net/zhangdongren/article/details/83344048 区别如下: tf.random_normal(shape,mean=0.0,stddev=1.0,dtype=tf.float32,seed=None,name=None ...
分类:
其他好文 时间:
2019-11-10 10:23:55
阅读次数:
121
一、numpy 数组对象(numpy.ndarray) ndarray 是一个多维的数组类: 实际数据 描述信息 创建对象、索引、切片: 1 #python 2 3 import numpy as np 4 5 # 创建ndarray 对象 6 a = np.arange(6) 7 print(a. ...
分类:
其他好文 时间:
2019-11-09 23:29:34
阅读次数:
126
tf.squeeze()函数的作用是从tensor中删除所有大小(szie)是1的维度。 给定丈量输入, 此操作返回的是相同类型的张量, 并删除所有尺寸为1的维度。如果不想删除所有尺寸为1的维度, 可以通过指定squeeze_dims来删除特定维度。 下面通过例子来理解: # 't' is a te ...
分类:
其他好文 时间:
2019-11-09 10:09:37
阅读次数:
110
Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint the path from his house to the gate. The pa ...
分类:
其他好文 时间:
2019-11-09 00:25:44
阅读次数:
99
# -*- coding: utf-8 -*-import tensorflow as tfdef als_tf(user_item_matrix, feature_num, train_times, reg): user_num, item_num = user_item_matrix.shape ...
分类:
其他好文 时间:
2019-11-08 17:42:03
阅读次数:
146