API 相关说明
返回一个与输入张量形状相同的且值为给定值的零张量
inp (Union[Tensor, SymbolVar]) – input tensor.
Union
Tensor
SymbolVar
value (Union[int, float]) – target value.
int
float
Union[Tensor, SymbolVar]
output tensor.
实际案例
import numpy as np from megengine import tensor import megengine.functional as F inp = tensor(np.arange(1, 7, dtype=np.int32).reshape(2,3)) out = F.full_like(inp, 2) print(out.numpy())
Outputs:
[[2 2 2] [2 2 2]]
上一页
megengine.functional.full
下一页
megengine.functional.copy