提交 be600f45 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Add string description for Rebroadcast.

Dimensions where the broadcastable flag is added are marked denoted by '1', dimensions where it is removed are displayed as '0', the ones left unchanged are marked by '?'. This list is implicitly extended to the right by as many '?' as needed.
上级 090b9a0f
......@@ -2574,6 +2574,11 @@ class Rebroadcast(Op):
view_map = {0: [0]}
def __init__(self, *axis):
self.axis = dict(axis)
def __str__(self):
broadcast_pattern = ['?' for i in range(1+numpy.max(self.axis.keys()))]
for k,v in self.axis.iteritems():
broadcast_pattern[k] = str(int(v))
return '%s{%s}' % (self.__class__.__name__, ','.join(broadcast_pattern))
def make_node(self, x):
t = x.type.__class__(dtype = x.type.dtype,
broadcastable = [self.axis.get(i, b)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论