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