当前位置:网站首页>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?
- Interview vipshop internship testing post, Tiktok internship testing post [true submission]
- IP netns command (memo)
- Thread factory in thread pool
- 3.关于cookie
- 面试唯品会实习测试岗、抖音实习测试岗【真实投稿】
- Redis集群与扩展
- Sports Federation: resume offline sports events in a safe and orderly manner, and strive to do everything possible for domestic events
- Comparison and selection of kubernetes Devops CD Tools
- 我感觉被骗了,微信内测 “大小号” 功能,同一手机号可注册两个微信
猜你喜欢

如何选择合适的自动化测试工具?

The top of slashdata developer tool is up to you!!!

虚拟数字人里的生意经

Multimodal point cloud fusion and visual location based on image and laser

Tsinghua, Cambridge and UIC jointly launched the first Chinese fact verification data set: evidence-based, covering many fields such as medical society

Wechat web debugging 8.0.19 replace the X5 kernel with xweb, so the X5 debugging method can no longer be used. Now there is a solution

【软件测试】从企业版BOSS直聘,看求职简历,你没被面上是有原因的
![[paper sharing] where's crypto?](/img/27/9b47bfcdff8307e63f2699d6a4e1b4.png)
[paper sharing] where's crypto?

In 2021, the national average salary was released. Have you reached the standard?

Creative changes brought about by the yuan universe
随机推荐
Basic concepts and properties of binary tree
Reinforcement learning - learning notes 8 | Q-learning
Charles+Postern的APP抓包
Redis
gsap动画库
嵌入式面试题(算法部分)
二叉树的基本概念和性质
AI来搞财富分配比人更公平?来自DeepMind的多人博弈游戏研究
能同时做三个分割任务的模型,性能和效率优于MaskFormer!Meta&UIUC提出通用分割模型,性能优于任务特定模型!开源!...
Teach your sister to write the message queue hand in hand
RISCV64
2022上半年朋友圈都在传的10本书,找到了
Reject policy of thread pool
标准ACL与扩展ACL
PTA 1102 teaching Super Champion volume
POJ 1182 :食物链(并查集)[通俗易懂]
Nat address translation
6. About JWT
Classification and application of enterprise MES Manufacturing Execution System
Redis publishing and subscription

>





