numpy.tile(A, reps)

编程入门 行业动态 更新时间:2024-10-19 06:19:08

<a href=https://www.elefans.com/category/jswz/34/1769516.html style=numpy.tile(A, reps)"/>

numpy.tile(A, reps)

numpy.tile(A, reps)
Parameters:
A : The input array.
reps : The number of repetitions of A along each axis

import torch
import numpy as npx = torch.from_numpy(np.arange(4).reshape((1, 4)))print('tensor原型:', x)print('x沿着维度0复制2倍', np.tile(x, 2))
print('x沿着维度0、维度1,分别复制2倍、2倍', np.tile(x, (2, 2)))
print('x沿着维度0、维度1、维度2,分别复制2倍、2倍、2倍', np.tile(x, (2, 2, 2)))

代码运行结果:

tensor原型: tensor([[0, 1, 2, 3]])
x沿着维度0复制2倍 [[0 1 2 3 0 1 2 3]]
x沿着维度0、维度1,分别复制2倍、2倍 [[0 1 2 3 0 1 2 3][0 1 2 3 0 1 2 3]]
x沿着维度0、维度1、维度2,分别复制2倍、2倍、2倍 [[[0 1 2 3 0 1 2 3][0 1 2 3 0 1 2 3]][[0 1 2 3 0 1 2 3][0 1 2 3 0 1 2 3]]]

更多推荐

numpy.tile(A, reps)

本文发布于:2024-02-25 19:53:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1700117.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:numpy   tile   reps

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!