当前位置:网站首页>Numpy——2.数组的形状
Numpy——2.数组的形状
2022-07-07 17:03:00 【头发没了还会再长】
数组的形状
查看数组的形状
a.shape()
可以通过返回值数的个数来判断数组是几维的
修改数组的形状
a.reshape(x, y)
有返回值但不修改a数组a.flatten()
将数组直接变成一维>
数组的计算
数组和数的计算
广播机制
数组和一个数进行计算的时候,将这个数作用到数组的每一个元素上面,其实这个数被展开成为和数组的维数,行数,列数一样的数组了,然后对应元素做运算
数组和数组的计算
相同shape的数组的计算,直接让对应元素做加减乘除即可
不同shape的数组的计算,如果是二维的,行和列必须有一维是相同的,另一维是1。如果是3维的减去一个二维的,也是看行和列
也是广播机制,会把行或者列小的那一维扩展为大的那一个
example 二维
example 三维
边栏推荐
猜你喜欢
Desci: is decentralized science the new trend of Web3.0?
Complete e-commerce system
Redis
如何选择合适的自动化测试工具?
I feel cheated. Wechat tests the function of "size number" internally, and two wechat can be registered with the same mobile number
静态路由配置
RISCV64
高温火烧浑不怕,钟薛高想留清白在人间
The performance and efficiency of the model that can do three segmentation tasks at the same time is better than maskformer! Meta & UIUC proposes a general segmentation model with better performance t
[tpm2.0 principle and Application guide] Chapter 16, 17 and 18
随机推荐
[tpm2.0 principle and Application guide] Chapter 9, 10 and 11
The moveposition function of rigidbody2d of unity2d solves the problem of people or screen jitter when moving
POJ 1182 :食物链(并查集)[通俗易懂]
手把手教姐姐写消息队列
cmd命令进入MySQL时报服务名或者命令错误(傻瓜式教学)
线程池中的线程工厂
Usage of PHP interview questions foreach ($arr as $value) and foreach ($arr as $value)
How many times is PTA 1101 B than a
虚拟数字人里的生意经
脑洞从何而来?加州大学最新研究:有创造力的人神经连接会「抄近道」
CVPR 2022 - learning non target knowledge for semantic segmentation of small samples
面试唯品会实习测试岗、抖音实习测试岗【真实投稿】
静态路由配置
【HDU】5248-序列变换(贪心+二分)「建议收藏」
Multimodal point cloud fusion and visual location based on image and laser
单臂路由和三层交换的简单配置
AI来搞财富分配比人更公平?来自DeepMind的多人博弈游戏研究
Complete e-commerce system
Cloud security daily 220707: Cisco Expressway series and telepresence video communication server have found remote attack vulnerabilities and need to be upgraded as soon as possible
Cadre de validation des données Apache bval réutilisé