提交 b4536dce authored 作者: Iban Harlouchet's avatar Iban Harlouchet

numpydoc for theano/typed_list/basic.py

上级 0a7415d7
...@@ -48,6 +48,7 @@ class _typed_list_py_operators: ...@@ -48,6 +48,7 @@ class _typed_list_py_operators:
class TypedListVariable(_typed_list_py_operators, Variable): class TypedListVariable(_typed_list_py_operators, Variable):
""" """
Subclass to add the typed list operators to the basic `Variable` class. Subclass to add the typed list operators to the basic `Variable` class.
""" """
TypedListType.Variable = TypedListVariable TypedListType.Variable = TypedListVariable
...@@ -104,8 +105,13 @@ getitem = GetItem() ...@@ -104,8 +105,13 @@ getitem = GetItem()
""" """
Get specified slice of a typed list. Get specified slice of a typed list.
:param x: typed list. Parameters
:param index: the index of the value to return from `x`. ----------
x
Typed list.
index
The index of the value to return from `x`.
""" """
...@@ -174,8 +180,13 @@ append = Append() ...@@ -174,8 +180,13 @@ append = Append()
""" """
Append an element at the end of another list. Append an element at the end of another list.
:param x: the base typed list. Parameters
:param y: the element to append to `x`. ----------
x
The base typed list.
y
The element to append to `x`.
""" """
...@@ -250,8 +261,13 @@ extend = Extend() ...@@ -250,8 +261,13 @@ extend = Extend()
""" """
Append all elements of a list at the end of another list. Append all elements of a list at the end of another list.
:param x: The typed list to extend. Parameters
:param toAppend: The typed list that will be added at the end of `x`. ----------
x
The typed list to extend.
toAppend
The typed list that will be added at the end of `x`.
""" """
...@@ -325,9 +341,15 @@ insert = Insert() ...@@ -325,9 +341,15 @@ insert = Insert()
""" """
Insert an element at an index in a typed list. Insert an element at an index in a typed list.
:param x: the typed list to modify. Parameters
:param index: the index where to put the new element in `x`. ----------
:param toInsert: The new element to insert. x
The typed list to modify.
index
The index where to put the new element in `x`.
toInsert
The new element to insert.
""" """
...@@ -356,9 +378,9 @@ class Remove(Op): ...@@ -356,9 +378,9 @@ class Remove(Op):
out[0] = x out[0] = x
""" """
inelegant workaround for ValueError: The truth value of an Inelegant workaround for ValueError: The truth value of an
array with more than one element is ambiguous. Use a.any() or a.all() array with more than one element is ambiguous. Use a.any() or a.all()
being thrown when trying to remove a matrix from a matrices list being thrown when trying to remove a matrix from a matrices list.
""" """
for y in range(out[0].__len__()): for y in range(out[0].__len__()):
if node.inputs[0].ttype.values_eq(out[0][y], toRemove): if node.inputs[0].ttype.values_eq(out[0][y], toRemove):
...@@ -371,13 +393,18 @@ class Remove(Op): ...@@ -371,13 +393,18 @@ class Remove(Op):
remove = Remove() remove = Remove()
"""Remove an element from a typed list. """Remove an element from a typed list.
:param x: the typed list to be changed. Parameters
:param toRemove: an element to be removed from the typed list. ----------
x
The typed list to be changed.
toRemove
An element to be removed from the typed list.
We only remove the first instance. We only remove the first instance.
:note: Python implementation of remove doesn't work when we want to Notes
remove an ndarray from a list. This implementation works in that -----
case. Python implementation of remove doesn't work when we want to remove an ndarray
from a list. This implementation works in that case.
""" """
...@@ -437,7 +464,11 @@ reverse = Reverse() ...@@ -437,7 +464,11 @@ reverse = Reverse()
""" """
Reverse the order of a typed list. Reverse the order of a typed list.
:param x: the typed list to be reversed. Parameters
----------
x
The typed list to be reversed.
""" """
...@@ -452,7 +483,7 @@ class Index(Op): ...@@ -452,7 +483,7 @@ class Index(Op):
def perform(self, node, inputs, outputs): def perform(self, node, inputs, outputs):
""" """
inelegant workaround for ValueError: The truth value of an Inelegant workaround for ValueError: The truth value of an
array with more than one element is ambiguous. Use a.any() or a.all() array with more than one element is ambiguous. Use a.any() or a.all()
being thrown when trying to remove a matrix from a matrices list being thrown when trying to remove a matrix from a matrices list
""" """
...@@ -480,7 +511,7 @@ class Count(Op): ...@@ -480,7 +511,7 @@ class Count(Op):
def perform(self, node, inputs, outputs): def perform(self, node, inputs, outputs):
""" """
inelegant workaround for ValueError: The truth value of an Inelegant workaround for ValueError: The truth value of an
array with more than one element is ambiguous. Use a.any() or a.all() array with more than one element is ambiguous. Use a.any() or a.all()
being thrown when trying to remove a matrix from a matrices list being thrown when trying to remove a matrix from a matrices list
""" """
...@@ -499,13 +530,18 @@ count = Count() ...@@ -499,13 +530,18 @@ count = Count()
""" """
Count the number of times an element is in the typed list. Count the number of times an element is in the typed list.
:param x: The typed list to look into. Parameters
:param elem: The element we want to count in list. ----------
x
The typed list to look into.
elem
The element we want to count in list.
The elements are compared with equals. The elements are compared with equals.
:note: Python implementation of count doesn't work when we want to Notes
count an ndarray from a list. This implementation works in that -----
case. Python implementation of count doesn't work when we want to count an ndarray
from a list. This implementation works in that case.
""" """
...@@ -543,7 +579,11 @@ length = Length() ...@@ -543,7 +579,11 @@ length = Length()
""" """
Returns the size of a list. Returns the size of a list.
:param x: typed list. Parameters
----------
x
Typed list.
""" """
...@@ -573,7 +613,12 @@ make_list = MakeList() ...@@ -573,7 +613,12 @@ make_list = MakeList()
""" """
Build a Python list from those Theano variable. Build a Python list from those Theano variable.
:param a: tuple/list of Theano variable Parameters
----------
a : tuple/list of Theano variable
Notes
-----
All Theano variables must have the same type.
:note: All Theano variable must have the same type.
""" """
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论