Skip to content

Commit

Permalink
[skip ci] Update docs/snode.rst 2
Browse files Browse the repository at this point in the history
  • Loading branch information
archibate authored May 2, 2020
1 parent 6d78451 commit cd8e7c2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/snode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,32 @@ See :ref:`layout` for more details about data layout.
:parameter x: (tensor) tensor(s) to be placed
:return: (SNode) the ``snode`` itself

.. function:: snode.get_shape(index)

:parameter snode: (SNode)
:parameter index: alone which axis? (0 for ``i`` and 1 for ``j``)
:return: (scalar) the size of tensor alone that axis

Equivalent to snode.shape[i]

::
ti.root.dense(ti.ijk, (3, 5, 4)).place(x)
x.get_shape(0) # 3
x.get_shape(1) # 5
x.get_shape(2) # 4

.. function:: snode.dim()

:parameter snode: (SNode or tensor)
:return: (scalar) the dimension of node / tensor

Equivalent to `len(snode.shape)`.

::
ti.root.dense(ti.ijk, (8, 9, 10)).place(x)
x.dim() # 3

.. function:: ti.root

Expand Down

0 comments on commit cd8e7c2

Please sign in to comment.