megengine.functional.zeros

zeros(shape, dtype='float32', device=None)[源代码]

根据给定形状返回元素全为 0 的 Tensor

参数
  • shape – a list, tuple or integer defining the shape of the output tensor.

  • dtype – the desired data type of the output tensor. Default: float32.

  • device – the desired device of the output tensor. Default: if None, use the default device (see get_default_device).

返回类型

Tensor