numpy.dstack

原文链接:https://numpy.org/doc/1.17/reference/generated/numpy.dstack.html?highlight=dstack#numpy.dstack

numpy.dstack(tup)[source]

Stack arrays in sequence depth wise (along third axis).

This is equivalent to concatenation along the third axis after 2-D arrays of shape (M,N) have been reshaped to (M,N,1) and 1-D arrays of shape (N,) have been reshaped to (1,N,1). Rebuilds arrays divided by dsplit.

This function makes most sense for arrays with up to 3 dimensions. For instance, for pixel-data with a height (first axis), width (second axis), and r/g/b channels (third axis). The functions concatenate, stack and block provide more general stacking and concatenation operations.

Parameters:

tup : sequence of arrays The arrays must have the same shape along all but the third axis. 1-D or 2-D arrays must have the same shape.

Returns:

stacked : ndarray The array formed by stacking the given arrays, will be at least 3-D.

See also

stack

Join a sequence of arrays along a new axis.

vstack

Stack along first axis.

hstack

Stack along second axis.

concatenate

Join a sequence of arrays along an existing axis.

dsplit

Split array along third axis.

Examples

>>>

>>> a = np.array((1,2,3))
>>> b = np.array((2,3,4))
>>> np.dstack((a,b))
array([[[1, 2],
        [2, 3],
        [3, 4]]])

>>>

>>> a = np.array([[1],[2],[3]])
>>> b = np.array([[2],[3],[4]])
>>> np.dstack((a,b))
array([[[1, 2]],
       [[2, 3]],
       [[3, 4]]])

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • numpy.hstack

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 ...

    于小勇
  • numpy.vstack

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

    于小勇
  • 计算机视觉中的细节问题

    单阶段检测器训练的时候提出直接用已知的类进行分类和回归,而多阶段检测器先提出proposal,然后根据图像中目标的坐标和大小对proposal进行筛选,之后进行...

    于小勇
  • 如何具体实践微服务

    服务框架是一个比较成熟的领域,有太多可选项。Spring Boot/Cloud,由于 Spring 社区的影响力和 Netflix 的背书,目前可以认为是构建 ...

    分母为零
  • 带字幕的Youtube

    现在有人就制作了一个网站YouTube Subtitle Editor,专门为Youtube加字幕。你可以先看一段动画片《蜘蛛人》的主题歌,体验一下效果。

    ruanyf
  • SAP UI5 Nav container - how the inner control is added

    Created by Wang, Jerry, last modified on May 18, 2015

    Jerry Wang
  • SAP UI5 xml view content parse

    Created by Wang, Jerry, last modified on May 18, 2015

    Jerry Wang
  • 从单体应用走向服务化

    之前讲解了什么是微服务:微服务的核心在于服务治理,微服务架构是将复杂臃肿的单体应用进行细粒度的服务化拆分,每个拆分出来的服务各自独立打包部署,并交由小团队进行开...

    武培轩
  • 从单体应用走向服务化

    之前讲解了什么是微服务:微服务的核心在于服务治理,微服务架构是将复杂臃肿的单体应用进行细粒度的服务化拆分,每个拆分出来的服务各自独立打包部署,并交由小团队进行开...

    武培轩
  • 学习笔记-小甲鱼Python3学习第十七

    优秀的东西永远是经典的,经典的东西永远是简单的,不是说复杂不好,而是能够把复杂的东西简单化,堪称经典。

    py3study

扫码关注云+社区

领取腾讯云代金券