提交 80f18e40 authored 作者: Ian Goodfellow's avatar Ian Goodfellow

started docstrings for some Subtensor stuff

上级 848fa7b5
...@@ -3838,6 +3838,17 @@ class Subtensor(Op): ...@@ -3838,6 +3838,17 @@ class Subtensor(Op):
@staticmethod @staticmethod
def collapse(idxs, cond): def collapse(idxs, cond):
"""
idxs: a list of indices or slices.
cond: a callable that returns a bool
returns: idxs, with the slices flattened out into a list.
if cond is true for an entry, does not flatten it.
"""
ret = [] ret = []
def helper(entry): def helper(entry):
...@@ -3850,10 +3861,17 @@ class Subtensor(Op): ...@@ -3850,10 +3861,17 @@ class Subtensor(Op):
for idx in idxs: for idx in idxs:
helper(idx) helper(idx)
return ret return ret
@staticmethod @staticmethod
def convert(entry, slice_ok=True): def convert(entry, slice_ok=True):
"""
TODO: WRITEME
TODO: In particular, wtf does it mean to have a Type instead of a Variable
in here?
"""
invalid_scal_types = [scal.float64, scal.float32] invalid_scal_types = [scal.float64, scal.float32]
scal_types = [scal.int64, scal.int32, scal.int16, scal.int8] scal_types = [scal.int64, scal.int32, scal.int16, scal.int8]
tensor_types = [lscalar, iscalar, wscalar, bscalar] tensor_types = [lscalar, iscalar, wscalar, bscalar]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论