@@ -5867,11 +5867,49 @@ def multiplex(inputs, index):
5867
5867
"""
5868
5868
${comment}
5869
5869
5870
- >>> import paddle.fluid as fluid
5871
- >>> x1 = fluid.layers.data(name='x1', shape=[4], dtype='float32')
5872
- >>> x2 = fluid.layers.data(name='x2', shape=[4], dtype='float32')
5873
- >>> index = fluid.layers.data(name='index', shape=[1], dtype='int32')
5874
- >>> out = fluid.layers.multiplex(inputs=[x1, x2], index=index)
5870
+ For Example:
5871
+
5872
+ .. code-block:: text
5873
+
5874
+ case 1:
5875
+
5876
+ Given:
5877
+
5878
+ X = [[[0,0,3,4], [0,1,3,4], [0,2,4,4], [0,3,3,4]],
5879
+ [[1,0,3,4], [1,1,7,8], [1,2,4,2], [1,3,3,4]],
5880
+ [[2,0,3,4], [2,1,7,8], [2,2,4,2], [2,3,3,4]],
5881
+ [[3,0,3,4], [3,1,7,8], [3,2,4,2], [3,3,3,4]]]
5882
+
5883
+ index = [3,0,1,2]
5884
+
5885
+ out:[[3 0 3 4] // X[3,0] (3 = index[i], 0 = i); i=0
5886
+ [0 1 3 4] // X[0,1] (0 = index[i], 1 = i); i=1
5887
+ [1 2 4 2] // X[1,2] (0 = index[i], 2 = i); i=2
5888
+ [2 3 3 4]] // X[2,3] (0 = index[i], 3 = i); i=3
5889
+
5890
+ case 2:
5891
+
5892
+ Given:
5893
+
5894
+ X = [[[0,0,3,4], [0,1,3,4], [0,2,4,4], [0,3,3,4]],
5895
+ [[1,0,3,4], [1,1,7,8], [1,2,4,2], [1,3,3,4]]]
5896
+
5897
+ index = [1,0]
5898
+
5899
+ out:[[1 0 3 4] // X[1,0] (3 = index[0], 0 = i); i=1
5900
+ [0 1 3 4] // X[0,1] (0 = index[1], 1 = i); i=2
5901
+ [0 2 4 4] // X[0,2] (0 = 0, 2 = i); i=3
5902
+ [0 3 3 4]] // X[0,3] (0 = 0, 3 = i); i=4
5903
+
5904
+ Examples:
5905
+
5906
+ .. code-block:: python
5907
+
5908
+ import paddle.fluid as fluid
5909
+ x1 = fluid.layers.data(name='x1', shape=[4], dtype='float32')
5910
+ x2 = fluid.layers.data(name='x2', shape=[4], dtype='float32')
5911
+ index = fluid.layers.data(name='index', shape=[1], dtype='int32')
5912
+ out = fluid.layers.multiplex(inputs=[x1, x2], index=index)
5875
5913
5876
5914
Args:
5877
5915
inputs (list): ${x_comment}.
0 commit comments