File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
python/paddle/fluid/layers Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -111,8 +111,21 @@ def create_global_var(shape,
111
111
112
112
def cast (x , dtype ):
113
113
"""
114
- This function takes in the input with input_dtype
115
- and casts it to the output_dtype as the output.
114
+ This layer takes in the Variable :attr:`x` with :attr:`x.dtype` and casts
115
+ it to the output with :attr:`dtype`.
116
+
117
+ Args:
118
+ x (Variable): The input Variable for casting.
119
+ dtype(np.dtype|core.VarDesc.VarType|str): Data type of the output Variable.
120
+
121
+ Returns:
122
+ Variable: The output Variable after casting.
123
+
124
+ Examples:
125
+ .. code-block:: python
126
+
127
+ data = fluid.layers.data(name='x', shape=[13], dtype='float32')
128
+ result = fluid.layers.cast(x=data, dtype='float64')
116
129
"""
117
130
helper = LayerHelper ('cast' , ** locals ())
118
131
out = helper .create_tmp_variable (dtype = dtype )
You can’t perform that action at this time.
0 commit comments