宿舍大妈打球是什么水平?动图大姐姐带你去蹦迪啦

paddle. full_like ( x: paddle.Tensor, fill_value: bool | float, dtype: DTypeLike | None = None, name: str | None = None ) paddle.Tensor [source]
百度 泛悬疑主题往往包括了推理、侦探、惊悚、恐怖等多种风格。

This function creates a tensor filled with fill_value which has identical shape of x and dtype. If the dtype is None, the data type of Tensor is same with x.

Parameters
  • x (Tensor) – The input tensor which specifies shape and data type. The data type can be bool, float16, float32, float64, int32, int64.

  • fill_value (bool|float|int) – The value to fill the tensor with. Note: this value shouldn’t exceed the range of the output data type.

  • dtype (np.dtype|str, optional) – The data type of output. The data type can be one of bool, float16, float32, float64, int32, int64. The default value is None, which means the output data type is the same as input.

  • name (str|None, optional) – For details, please refer to Name. Generally, no setting is required. Default: None.

Returns

Tensor which is created according to x, fill_value and dtype.

Return type

Tensor

Examples

>>> import paddle

>>> input = paddle.full(shape=[2, 3], fill_value=0.0, dtype='float32', name='input')
>>> output = paddle.full_like(input, 2.0)
>>> print(output.numpy())
[[2. 2. 2.]
 [2. 2. 2.]]