constant_

class paddle.nn.init. constant_ ( tensor, val ) [源代码]

将输入张量的值设置为指定的常量,该操作会直接修改输入张量。

参数

  • tensor (Tensor) - 输入张量。

  • val (float) - 指定的填充输入张量的常量。