@@ -742,11 +742,10 @@ def topk(input, k):
742742
743743
744744def lod_tensor_to_array (x , table ):
745- """This function performs the operation that converts an LOD_Tensor to
746- an array.
745+ """ Convert a LOD_TENSOR to an LOD_TENSOR_ARRAY.
747746
748747 Args:
749- x (Variable|list): The tensor that needs to be converted to an array.
748+ x (Variable|list): The LOD tensor to be converted to a LOD tensor array.
750749 table (ParamAttr|list): The variable that stores the level of lod
751750 which is ordered by sequence length in
752751 descending order.
@@ -776,11 +775,10 @@ def lod_tensor_to_array(x, table):
776775
777776
778777def array_to_lod_tensor (x , table ):
779- """This function performs the operations that converts an array to
780- an LOD_Tensor.
778+ """Convert a LoD_Tensor_Aarry to an LoDTensor.
781779
782780 Args:
783- x (Variable|list): The array that needs to be converted to a tensor.
781+ x (Variable|list): The lod tensor array to be converted to a tensor.
784782 table (ParamAttr|list): The variable that stores the level of lod
785783 which is ordered by sequence length in
786784 descending order.
@@ -808,7 +806,8 @@ def array_to_lod_tensor(x, table):
808806
809807
810808def increment (x , value = 1.0 , in_place = True ):
811- """This function performs an operation that increments each value in the
809+ """
810+ This function performs an operation that increments each value in the
812811 input :math:`x` by an amount: :math:`value` as mentioned in the input
813812 parameter. This operation is performed in-place by default.
814813
@@ -841,17 +840,24 @@ def increment(x, value=1.0, in_place=True):
841840
842841
843842def array_write (x , i , array = None ):
844- """This function performs the operation to write the data out as an
845- LOD_TENSOR_ARRAY.
843+ """
844+ This function writes the given input variable to the specified position
845+ indicating by the arrary index to an output LOD_TENSOR_ARRAY. If the
846+ output LOD_TENSOR_ARRAY is not given(None), a new one will be created and
847+ returned.
846848
847849 Args:
848850 x (Variable|list): The input tensor from which the data will be read.
849- i (Variable|list): The subscript index in tensor array, that points the
850- place from which data will be read.
851- array (Variable|list): The data can be read into this variable if
852- this is assigned.
851+ i (Variable|list): The index of the output LOD_TENSOR_ARRAY, pointing to
852+ the position to which the input tensor will be
853+ written.
854+ array (Variable|list): The output LOD_TENSOR_ARRAY to which the input
855+ tensor will be written. If this parameter is
856+ NONE, a new LOD_TENSOR_ARRAY will be created and
857+ returned.
858+
853859 Returns:
854- Variable: The tensor type variable that has the data written to it .
860+ Variable: The output LOD_TENSOR_ARRAY where the input tensor is written .
855861
856862 Examples:
857863 .. code-block::python
@@ -1228,7 +1234,7 @@ def step_input(self, x):
12281234 self ._assert_in_rnn_block_ ("step_input" )
12291235 if not isinstance (x , Variable ):
12301236 raise TypeError (
1231- "step_input() can only take a Variable as its input" )
1237+ "step_input() can only take a Variable as its input. " )
12321238 parent_block = self ._parent_block_ ()
12331239 if self .lod_rank_table is None :
12341240 self .lod_rank_table = parent_block .create_var (
@@ -1289,8 +1295,8 @@ def block(self):
12891295
12901296 def __call__ (self , * args , ** kwargs ):
12911297 if self .status != DynamicRNN .AFTER_RNN :
1292- raise ValueError (
1293- "Dynamic RNN outputs can only be retrieved after rnn block" )
1298+ raise ValueError (( "Output of the dynamic RNN can only be visited "
1299+ "outside the rnn block." ) )
12941300 if len (self .outputs ) == 1 :
12951301 return self .outputs [0 ]
12961302 else :
0 commit comments