当前位置:网站首页>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
边栏推荐
猜你喜欢
Markdown编辑器
Lessons and thoughts of the first SQL injection
Introduction to namespace Basics
Techniques d'utilisation de sublime
深入解析Kubebuilder
动态生成表格
Vscode automatically adds a semicolon and jumps to the next line
A detailed explanation of head pose estimation [collect good articles]
Monitoring cannot be started after Oracle modifies the computer name
Flex layout and usage
随机推荐
Jetson nano configures pytorch deep learning environment / / to be improved
Run the command once per second in Bash- Run command every second in Bash?
How to package the parsed Excel data into objects and write this object set into the database?
JS variable case output user name
sublime使用技巧
Time complexity & space complexity
Markdown editor
[736. LISP syntax parsing]
【ArcGIS教程】专题图制作-人口密度分布图——人口密度分析
JS variable case
[Yugong series] go teaching course 005 variables in July 2022
U++4 接口 学习笔记
Vscode automatically adds a semicolon and jumps to the next line
谈谈讲清楚这件事的重要性
Two methods of chromosome coordinate sequencing
Weebly移动端网站编辑器 手机浏览新时代
Ansible overview and module explanation (you just passed today, but yesterday came to your face)
3GPP信道模型路损基础知识
ClickHouse(03)ClickHouse怎么安装和部署
装饰器基础学习02