mindspore/docs/api/api_python/mint/mindspore.mint.nn.ConstantP...

29 lines
1.0 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.mint.nn.ConstantPad2d
===============================
.. py:class:: mindspore.mint.nn.ConstantPad2d(padding, value)
根据参数 `padding` 以及 `value` 对输入 `input` 最后2维进行填充。
更多参考详见 :func:`mindspore.mint.nn.functional.pad`
.. warning::
这是一个实验性API后续可能修改或删除。
参数:
- **padding** (Union[int, tuple, list]) - 指定填充的大小。
- **value** (Union[int, float]) - 指定填充值。
输入:
- **input** (Tensor) - 输入Tensorshape为 :math:`(N, *)`,其中 :math:`*` 表示任意维度。
输出:
Tensor填充后的Tensor。
异常:
- **TypeError** - `padding` 不是一个integer或包含4个int的tuple或者list。
- **TypeError** - `input` 不是Tensor。
- **TypeError** - `value` 既不是int也不是float。
- **ValueError** - `padding` 含有负数。
- **ValueError** - `padding` 是tuple或list且长度和Tensor的维度不匹配。