文档反馈

问题文档片段

问题文档片段包含公式时,显示为空格。

提交类型
issue

有点复杂...

找人问问吧。

请选择提交类型

问题类型
规范和低错类

- 规范和低错类:

- 错别字或拼写错误,标点符号使用错误、公式错误或显示异常。

- 链接错误、空单元格、格式错误。

- 英文中包含中文字符。

- 界面和描述不一致,但不影响操作。

- 表述不通顺,但不影响理解。

- 版本号不匹配:如软件包名称、界面版本号。

易用性

- 易用性:

- 关键步骤错误或缺失,无法指导用户完成任务。

- 缺少主要功能描述、关键词解释、必要前提条件、注意事项等。

- 描述内容存在歧义指代不明、上下文矛盾。

- 逻辑不清晰,该分类、分项、分步骤的没有给出。

正确性

- 正确性:

- 技术原理、功能、支持平台、参数类型、异常报错等描述和软件实现不一致。

- 原理图、架构图等存在错误。

- 命令、命令参数等错误。

- 代码片段错误。

- 命令无法完成对应功能。

- 界面错误,无法指导操作。

- 代码样例运行报错、运行结果不符。

风险提示

- 风险提示:

- 对重要数据或系统存在风险的操作,缺少安全提示。

内容合规

- 内容合规:

- 违反法律法规,涉及政治、领土主权等敏感词。

- 内容侵权。

请选择问题类型

问题描述

点击输入详细问题描述,以帮助我们快速定位问题。

mindspore.nn.Conv3d

class mindspore.nn.Conv3d(in_channels, out_channels, kernel_size, stride=1, pad_mode='same', padding=0, dilation=1, group=1, has_bias=False, weight_init='normal', bias_init='zeros', data_format='NCDHW')[source]

3D convolution layer.

Applies a 3D convolution over an input tensor which is typically of shape (N,Cin,Din,Hin,Win) and output shape (N,Cout,Dout,Hout,Wout). where N is batch size. C is channel number. the formula is defined as:

out(Ni,Coutj)=bias(Coutj)+k=0Cin1ccor(weight(Coutj,k),input(Ni,k))

where ccor is the cross-correlation operator.

If the ‘pad_mode’ is set to be “valid”, the output depth, height and width will be 1+Din+padding[0]+padding[1]kernel_size[0](kernel_size[0]1)×(dilation[0]1)stride[0] and 1+Hin+padding[2]+padding[3]kernel_size[1](kernel_size[1]1)×(dilation[1]1)stride[1] and 1+Win+padding[4]+padding[5]kernel_size[2](kernel_size[2]1)×(dilation[2]1)stride[2] respectively.

Parameters
  • in_channels (int) – The number of input channel Cin.

  • out_channels (int) – The number of output channel Cout.

  • kernel_size (Union[int, tuple[int]]) – The data type is int or a tuple of 3 integers. Specifies the depth, height and width of the 3D convolution window. Single int means the value is for the depth, height and the width of the kernel. A tuple of 3 ints means the first value is for the depth, the second value is for the height and the other is for the width of the kernel.

  • stride (Union[int, tuple[int]]) – The distance of kernel moving, an int number that represents the depth, height and width of movement are both strides, or a tuple of three int numbers that represent depth, height and width of movement respectively. Default: 1.

  • pad_mode (str) –

    Specifies padding mode. The optional values are “same”, “valid”, “pad”. Default: “same”.

    • same: Adopts the way of completion. The depth, height and width of the output will be the same as the input x. The total number of padding will be calculated in depth, horizontal and vertical directions and evenly distributed to head and tail, top and bottom, left and right if possible. Otherwise, the last extra padding will be done from the tail, bottom and the right side. If this mode is set, padding must be 0.

    • valid: Adopts the way of discarding. The possible largest depth, height and width of output will be returned without padding. Extra pixels will be discarded. If this mode is set, padding must be 0.

    • pad: Implicit paddings on both sides of the input x in depth, height, width. The number of padding will be padded to the input Tensor borders. padding must be greater than or equal to 0.

  • padding (Union(int, tuple[int])) – Implicit paddings on both sides of the input x. The data type is int or a tuple of 6 integers. Default: 0. If padding is an integer, the paddings of head, tail, top, bottom, left and right are the same, equal to padding. If paddings is a tuple of six integers, the padding of head, tail, top, bottom, left and right equal to padding[0], padding[1], padding[2], padding[3], padding[4] and padding[5] correspondingly.

  • dilation (Union[int, tuple[int]]) – The data type is int or a tuple of 3 integers (dilationd,dilationh,dilationw). Currently, dilation on depth only supports the case of 1. Specifies the dilation rate to use for dilated convolution. If set to be k>1, there will be k1 pixels skipped for each sampling location. Its value must be greater or equal to 1 and bounded by the height and width of the input x. Default: 1.

  • group (int) – Splits filter into groups, in_ channels and out_channels must be divisible by the number of groups. Default: 1. Only 1 is currently supported.

  • has_bias (bool) – Specifies whether the layer uses a bias vector. Default: False.

  • weight_init (Union[Tensor, str, Initializer, numbers.Number]) – Initializer for the convolution kernel. It can be a Tensor, a string, an Initializer or a number. When a string is specified, values from ‘TruncatedNormal’, ‘Normal’, ‘Uniform’, ‘HeUniform’ and ‘XavierUniform’ distributions as well as constant ‘One’ and ‘Zero’ distributions are possible. Alias ‘xavier_uniform’, ‘he_uniform’, ‘ones’ and ‘zeros’ are acceptable. Uppercase and lowercase are both acceptable. Refer to the values of Initializer for more details. Default: ‘normal’.

  • bias_init (Union[Tensor, str, Initializer, numbers.Number]) – Initializer for the bias vector. Possible Initializer and string are the same as ‘weight_init’. Refer to the values of Initializer for more details. Default: ‘zeros’.

  • data_format (str) – The optional value for data format. Currently only support “NCDHW”.

Inputs:
  • x (Tensor) - Tensor of shape (N,Cin,Din,Hin,Win). Currently input data type only support float16 and float32.

Outputs:

Tensor, the value that applied 3D convolution. The shape is (N,Cout,Dout,Hout,Wout).

Raises
  • TypeError – If in_channels, out_channels or group is not an int.

  • TypeError – If kernel_size, stride, padding or dilation is neither an int nor a tuple.

  • ValueError – If out_channels, kernel_size, stride or dilation is less than 1.

  • ValueError – If padding is less than 0.

  • ValueError – If pad_mode is not one of ‘same’, ‘valid’, ‘pad’.

  • ValueError – If padding is a tuple whose length is not equal to 6.

  • ValueError – If pad_mode is not equal to ‘pad’ and padding is not equal to (0, 0, 0, 0, 0, 0).

  • ValueError – If data_format is not ‘NCDHW’.

Supported Platforms:

Ascend GPU

Examples

>>> x = Tensor(np.ones([16, 3, 10, 32, 32]), mindspore.float32)
>>> conv3d = nn.Conv3d(in_channels=3, out_channels=32, kernel_size=(4, 3, 3))
>>> output = conv3d(x)
>>> print(output.shape)
(16, 32, 10, 32, 32)