当前位置:网站首页>numpy.zeros_ like
numpy.zeros_ like
2022-07-26 20:14:00 【Wanderer001】
numpy.zeros_like(a, dtype=None, order='K', subok=True, shape=None)[source]
Return an array of zeros with the same shape and type as a given array.
Parameters:
a:array_like
The shape and data-type of a define these same attributes of the returned array.
dtype:data-type, optional
Overrides the data type of the result.
New in version 1.6.0.
order:{‘C’, ‘F’, ‘A’, or ‘K’}, optional
Overrides the memory layout of the result. ‘C’ means C-order, ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, ‘C’ otherwise. ‘K’ means match the layout of a as closely as possible.
New in version 1.6.0.
subok:bool, optional.
If True, then the newly created array will use the sub-class type of ‘a’, otherwise it will be a base-class array. Defaults to True.
shape:int or sequence of ints, optional.
Overrides the shape of the result. If order=’K’ and the number of dimensions is unchanged, will try to keep order, otherwise, order=’C’ is implied.
New in version 1.17.0.
Returns:
out:ndarray
Array of zeros with the same shape and type as a.
See also
Return an empty array with shape and type of input.
Return an array of ones with shape and type of input.
Return a new array with shape of input filled with value.
Return a new array setting values to zero.
Examples
>>> x = np.arange(6)
>>> x = x.reshape((2, 3))
>>> x
array([[0, 1, 2],
[3, 4, 5]])
>>> np.zeros_like(x)
array([[0, 0, 0],
[0, 0, 0]])
>>> y = np.arange(3, dtype=float)
>>> y
array([0., 1., 2.])
>>> np.zeros_like(y)
array([0., 0., 0.])边栏推荐
猜你喜欢
随机推荐
计算机专业面试题目总结,总导航
EFCore Migrations的深入研究
Solution to the third game of 2022 Niuke multi school league
Three implementation methods of C # client program calling external program
安全测试初学体验
【OBS】解决OBS推两个rtmp流 + 带时间戳问题
I tried many report tools and finally found a report based on Net 6
Strengthen supervision on secret room escape and script killing, and focus on strengthening fire safety and juvenile protection
【JVM 系列】JVM 调优
URL格式
DevOps 实践多年,最痛的居然是?
vs如何读取mysql中的数据(顺便通过代码解决了中文乱码问题)
LeetCode_回溯_中等_216.组合总和 III
numpy.put()
网红辣条抓不住年轻人
three.js 制作地球标注的两种方法
.net GC workflow
Scope in JS
Zhongtian steel uses tdengine in GPS and AIS scheduling
2022年下半年(软考高级)信息系统项目管理师报名条件









