You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The OP creates a tensor of specified :attr:`shape` and :attr:`dtype`, and fills it with 1.
121
125
122
126
Args:
123
-
shape(tuple|list): Shape of output tensor.
124
-
dtype(np.dtype|core.VarDesc.VarType|str): Data type of output tensor, it supports
125
-
bool, float16, float32, float64, int32 and int64.
126
-
out(Variable, optional): Optional output which can be any created
127
-
Variable that meets the requirements to store the result of operation.
128
-
if out is None, a new Varibale will be create to store the result.
129
-
device(str, optional): Which device to run the operator. The :attr:`device` must be
130
-
None,'cpu', 'gpu'. If :attr:`device` is None, it will be choose the device that the user set in
131
-
the paddle program. Default value is False.
132
-
127
+
shape(tuple|list|Variable): Shape of output tensor, the data type of shape is int32 or int64.
128
+
dtype(np.dtype|core.VarDesc.VarType|str, optional): Data type of output tensor, it supports
129
+
bool, float16, float32, float64, int32 and int64. Default: if None, the data type is 'float32'.
130
+
name(str, optional): The default value is None. Normally there is no need for user to set this property. For more information, please refer to :ref:`api_guide_Name`
131
+
133
132
Returns:
134
133
Variable: A tensor of data type :attr:`dtype` with shape :attr:`shape` and all elements set to 1.
135
134
135
+
Raises:
136
+
TypeError: The dtype must be one of bool, float16, float32, float64, int32, int64 and None
137
+
and the data type of out Tensor must be the same as the dtype.
138
+
TypeError: The `shape` must be one of list, tuple and Variable.
0 commit comments