Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API reference] add some examples to help user understand #14302

Closed
tink2123 opened this issue Nov 7, 2018 · 0 comments · Fixed by #15681
Closed

[API reference] add some examples to help user understand #14302

tink2123 opened this issue Nov 7, 2018 · 0 comments · Fixed by #15681
Assignees

Comments

@tink2123
Copy link
Contributor

tink2123 commented Nov 7, 2018

背景:
阅读API reference时,发现有部分内容较简略,仅阅读文档并不清楚这个 API 的作用。因此希望可以为它们增加示例,帮助使用者理解。

修改如下:

  1. stack
    文字描述较为抽象,且没有说明不接受 int 数据
    default

增加例子:

*case 0:
  Given 
    x = [ [1.0 , 2.0 ] ]
    y = [ [3.0 , 4.0 ] ]
    z = [ [5.0 , 6.0 ] ]
  and
    axis = 0 
  output is:
   out = [ [ [1.0, 2.0] ],
           [ [3.0, 4.0] ],
           [ [5.0, 6.0] ] ]


*case 1:
  Given 
    x = [ [1.0 , 2.0 ] ]
    y = [ [3.0 , 4.0 ] ]
    z = [ [5.0 , 6.0 ] ]
  and
    axis = 1 or axis = -2
  output is:
   out = [ [ [1.0,2.0]
             [3.0,4.0]
             [5.0,6.0] ] ]

*case 2:
  Given 
    x = [ [1.0 , 2.0 ] ]
    y = [ [3.0 , 4.0 ] ]
    z = [ [5.0 , 6.0 ] ]
  and
    axis = 2 or axis = -1
  output is:
   out = [ [ [1.0 ,3.0 ,5.0 ],
             [2.0 ,4.0 ,6.0 ] ] ]
  1. multiplex

文字描述较为抽象

default

增加例子:

*case 0 :
 
Given :

  X =  [  [ [0,0,3,4], [0,1,3,4], [0,2,4,4], [0,3,3,4] ] ,
          [ [1,0,3,4], [1,1,7,8], [1,2,4,2], [1,3,3,4] ] ,
          [ [2,0,3,4], [2,1,7,8], [2,2,4,2], [2,3,3,4] ] ,
          [ [3,0,3,4], [3,1,7,8], [3,2,4,2], [3,3,3,4] ]  ]

    index = [3,0,1,2]

out: 
     [ [3 0 3 4]    // X[3,0] (3 = index[ i ] , 0 = i )  ; i=0
       [0 1 3 4]    // X[0,1] (0 = index[ i ],  1= i )   ; i=1
       [1 2 4 2]    // X[1,2] (0 = index[ i ],  2= i )   ; i=2
       [2 3 3 4] ]  // X[2,3] (0 = index[ i ],  3= i )   ; i=3

*case 1:

Given :

  X =  [  [ [0,0,3,4], [0,1,3,4], [0,2,4,4], [0,3,3,4] ] ,
          [ [1,0,3,4], [1,1,7,8], [1,2,4,2], [1,3,3,4] ]   ]

    index = [1,0]

out: 
     [ [1 0 3 4]    // X[1,0] (3 = index[0], 0 = i )  ; i = 1
       [0 1 3 4]    // X[0,1] (0 = index[1], 1 = i )  ; i = 2
       [0 2 4 4]    // X[0,2] (0 = 0, 2 = i ) ; i = 3
       [0 3 3 4] ]  // X[0,3] (0 = 0, 3 = i ) ; i = 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants