megengine.functional.zeros¶
- zeros(shape, *, dtype='float32', device=None)[源代码]¶
 返回一个特定形状的全0的新tensor。
- 参数
 shape (int...) – 输出tensor的shape。
- 关键字参数
 dtype (
Tensor.dtype, optional) – output tensor data type.device (
Tensor.device, optional) – device on which to place the created tensor.
- 返回类型
 - 返回
 一个包含0的tensor。
实际案例
>>> F.zeros((2, 3)) Tensor([[0. 0. 0.] [0. 0. 0.]], device=xpux:0)