2024-03-29 12:23:40 发布
网友
给定一个切片的numpy数组,如下所示:
b = [a[..., i] for i in a.shape[-1]]
从b重新创建a最简单的方法是什么?你知道吗
b
a
比如:
for i in range(a.shape[-1]): c[..., i] = b[i]
你最初的操作应该是
b = numpy.rollaxis(a, axis=-1)
它将a的视图作为新数组而不是数组列表生成。你知道吗
相反的操作是
c = numpy.rollaxis(b, axis=0, start=b.ndim)
你最初的操作应该是
它将
a
的视图作为新数组而不是数组列表生成。你知道吗相反的操作是
相关问题 更多 >
编程相关推荐