当前位置:网站首页>np.random.shuffle与np.swapaxis或transpose一起时要慎用
np.random.shuffle与np.swapaxis或transpose一起时要慎用
2022-07-06 22:49:00 【构建的乐趣】
# y = np.transpose(y,(1,0,2))
# y = np.random.shuffle(y)
# y = np.transpose(y,(1,0,2))
以上这三行代码会导致ValueError: axes don't match array的错误,
无独有偶,如果使用swapaxis–shuffle–swapaxis也会出现类似的错误。
要避开这一问题。
而要想对某一维度随机排列,可以使用permutation+切片的方案,shuffle仅仅只对axis 0随机。
参考文献
https://www.cnblogs.com/zmbreathing/p/random_shuffle.html
边栏推荐
- 2.证券投资基金的概述
- Depth first traversal template principle of tree and graph
- [ArcGIS tutorial] thematic map production - population density distribution map - population density analysis
- Flex layout and usage
- PLC Analog output analog output FB analog2nda (Mitsubishi FX3U)
- Run the command once per second in Bash- Run command every second in Bash?
- Common Oracle SQL statements
- Stm32f103ze+sht30 detection of ambient temperature and humidity (IIC simulation sequence)
- Leetcode longest public prefix
- AttributeError: module ‘torch._C‘ has no attribute ‘_cuda_setDevice‘
猜你喜欢

Monitoring cannot be started after Oracle modifies the computer name

Error: No named parameter with the name ‘foregroundColor‘

Time complexity & space complexity

九章云极DataCanvas公司蝉联中国机器学习平台市场TOP 3

AttributeError: module ‘torch._C‘ has no attribute ‘_cuda_setDevice‘

Depth first traversal template principle of tree and graph

Read of shell internal value command

Operand of null-aware operation ‘!‘ has type ‘SchedulerBinding‘ which excludes null.

How to package the parsed Excel data into objects and write this object set into the database?

Pointer and array are input in function to realize reverse order output
随机推荐
Operand of null-aware operation ‘!‘ has type ‘SchedulerBinding‘ which excludes null.
Comparison between thread and runnable in creating threads
Organize five stages of actual attack and defense drill
Liste des hôtes d'inventaire dans ansible (je vous souhaite des fleurs et de la romance sans fin)
批量归一化(标准化)处理
装饰器基础学习02
为什么很多人对技术债务产生误解
Field data acquisition and edge calculation scheme of CNC machine tools
If you‘re running pod install manually, make sure flutter pub get is executed first.
U++4 接口 学习笔记
2.证券投资基金的概述
3. Type of fund
Lessons and thoughts of the first SQL injection
Meaning of 'n:m' and '1:n' in database design
九章云极DataCanvas公司蝉联中国机器学习平台市场TOP 3
App embedded H5 --- iPhone soft keyboard blocks input text
R语言主成分pca、因子分析、聚类对地区经济研究分析重庆市经济指标
01 machine learning related regulations
A row of code r shows the table of Cox regression model
九章云极DataCanvas公司获评36氪「最受投资人关注的硬核科技企业」