Python-Numpy中的repmat

python 复制代码
np.tile
 
Python numpy 下的 np.tile有些类似于 matlab 中的 repmat函数。不需要 axis 关键字参数,仅通过第二个参数便可指定在各个轴上的复制倍数。
 
>> a = np.arange(3)
>> np.tile(a, 2)
array([0, 1, 2, 0, 1, 2])
>> np.tile(a, (2, 2))
array([[0, 1, 2, 0, 1, 2],
       [0, 1, 2, 0, 1, 2]])
 
>> b = np.arange(1, 5).reshape(2, 2)
>> np.tile(b, 2)
array([[1, 2, 1, 2],
       [3, 4, 3, 4]])
 
# 等价于
>> np.tile(b, (1, 2))
相关推荐
Direction_Wind4 分钟前
抖音视频下载,直播间监控,直播间发言采集,最新加密算法
python·node.js
旦莫11 分钟前
使用OCR加持的APP自动化测试
python·测试开发·自动化·ocr·pytest·ai测试
天若有情67313 分钟前
用 Python 爬取电商商品数据:从入门到反爬破解
开发语言·python
七夜zippoe15 分钟前
RabbitMQ与Celery深度集成:构建高性能Python异步任务系统
分布式·python·rabbitmq·celery·amqp
Hello阿尔法16 分钟前
SCons 一款基于 Python 的自动化构建工具
python·跨平台·构建工具·scons
Pyeako22 分钟前
Opencv计算机视觉--图像边缘检测
人工智能·python·opencv·计算机视觉·sobel·canny·图像边缘检测
深蓝电商API27 分钟前
Scrapy爬取Ajax动态加载页面三种实用方法
爬虫·python·scrapy·ajax
姓刘的哦28 分钟前
推理PyTorch模型的方法
人工智能·pytorch·python
4***175431 分钟前
Python酷库之旅-第三方库Pandas(051)
开发语言·python·pandas