python np.empty()函数
python np.empty()函数
·
np.empty()——依据给定形状和类型(shape,[dtype, order])返回一个新的空数组
官方解释:
np.empty()返回一个随机元素的矩阵,所以使用的时候要小心。需要手工把每一个值重新定义,否则该值是接近零的随机数。
gauss = np.empty((5, 64, 64), dtype=np.float64)
print(gauss)
结果:
[[[7.18634390e-312 7.19311879e-312 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
...
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]]
[[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
...
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]]
[[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
...
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]]
[[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
...
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]]
[[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
...
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]
[0.00000000e+000 0.00000000e+000 0.00000000e+000 ... 0.00000000e+000
0.00000000e+000 0.00000000e+000]]]
参考:
http://www.30daydo.com/article/376
更多推荐
已为社区贡献3条内容
所有评论(0)