megengine.functional.full¶
- full(shape, value, *, dtype=None, device=None)[source]¶
Returns a new tensor having a specified shape and filled with given value.
- Parameters
shape (int...) – output tensor shape.
value (Scalar) – fill value.
- Keyword Arguments
dtype (
Tensor.dtype
, optional) – output tensor data type. Ifdtype
isNone
, the output tensor data type must be inferred fromvalue
. If the value is anint
, the output tensor data type must be the default integer data type. If the value is afloat
, the output tensor data type must be the default floating-point data type. If the value is abool
, the output tensor must have boolean data type.device (
Tensor.device
, optional) – device on which to place the created tensor.
- Return type
- Returns
a tensor where every element is equal to
value
.
Examples
>>> F.full((2, 3), 6) Tensor([[6 6 6] [6 6 6]], dtype=int32, device=xpux:0)