nvidia.dali.fn.expand_dims#

nvidia.dali.fn.expand_dims(__data, /, *, axes, bytes_per_sample_hint=[0], new_axis_names='', preserve=False, device=None, name=None)#

将维度为 1 的新维度插入到数据形状中。

新维度插入的位置由 axes 指定。

如果提供了 new_axis_names,新的维度名称将插入到数据布局中,位置由 axes 指定。 如果未提供 new_axis_names,则输出数据布局将为空。”

此算子允许序列输入并支持体积数据。

支持的后端
  • ‘cpu’

  • ‘gpu’

参数:

__data (TensorList) – 要扩展的数据

关键字参数:
  • axes (intlist of intTensorList of int) – 插入新维度的索引。

  • bytes_per_sample_hint (int 或 list of int, 可选, 默认值 = [0]) –

    每个样本的输出大小提示(以字节为单位)。

    如果指定,则预先分配位于 GPU 或分页锁定主机内存中的算子输出,以容纳此大小的样本批次。

  • new_axis_names (layout str, 可选, 默认值 = ‘’) –

    数据布局中新维度的名称。

    new_axis_names 的长度必须与 axes 的长度匹配。 如果未提供参数,则布局将被清除。

  • preserve (bool, 可选, 默认值 = False) – 即使算子的输出未使用,也防止从图中删除算子。