第二届震中杯2017短片:FC红白机时代的地卜师

paddle. empty ( shape: ShapeLike, dtype: DTypeLike | None = None, name: str | None = None ) paddle.Tensor [source]
百度 二是实施创新驱动,不断提高科技创新能力,以创新效率克服西部地区经济系统的整体性劣势。

Returns a Tensor with uninitialized data which size is same as shape.

Parameters
  • shape (tuple|list|Tensor) – Shape of the Tensor to be created. The data type is int32 or int64 . If shape is a list or tuple, each element of it should be integer or 0-D Tensor with shape []. If shape is an Tensor, it should be an 1-D Tensor which represents a list.

  • dtype (np.dtype|str, optional) – Data type of the output Tensor which can be bool, float16, float32, float64, int32, int64, complex64, complex128 if dtype is None, the data type of created Tensor use global default dtype (see get_default_dtype for details).

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

Returns

Tensor which is created according to shape and dtype, and is uninitialized.

Return type

Tensor

Examples

>>> import paddle

>>> # shape is a list/tuple
>>> data1 = paddle.empty(shape=[3, 2])
>>> print(data1.numpy())
>>> 
[[1. 1.]
 [1. 1.]
 [1. 1.]]

>>> # shape is a Tensor
>>> shape = paddle.to_tensor([3, 2])
>>> data2 = paddle.empty(shape=shape)
>>> print(data2.numpy())
>>> 
[[1. 1.]
 [1. 1.]
 [1. 1.]]

>>> # shape is a Tensor List
>>> shape = [paddle.to_tensor(3), paddle.to_tensor(2)]
>>> data3 = paddle.empty(shape=shape)
>>> print(data3.numpy())
>>> 
[[1. 1.]
 [1. 1.]
 [1. 1.]]