mindspore/docs/api/api_python/nn/mindspore.nn.ConstantPad1d.rst

20 lines
969 B
ReStructuredText
Raw 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.nn.ConstantPad1d
==========================
.. py:class:: mindspore.nn.ConstantPad1d(padding, value)
将给定的常量填充到多维输入数据的最后一维。
参数:
- **padding** (Union[int, tuple]) - 指定填充的大小。如果 `padding` 的类型为int则在输入最后一维的前后均填充 `padding` 大小如果padding的类型为tuple形如(padding_0, padding_1),那么输入 `x` 对应输出的最后一维的shape为 :math:`padding\_0 + x.shape[-1] + padding\_1` ,输出的其余维度与输入保持一致。
- **value** (Union[int, float]) - 填充值。
返回:
Tensor填充后的Tensor。
异常:
- **TypeError** - `padding` 既不是tuple或者int。
- **TypeError** - `value` 既不是int也不是float。
- **ValueError** - tuple类型的 `padding` 长度不等于2。
- **ValueError** - 填充后输出的维度不是正数。