提交 001185db authored 作者: Razvan Pascanu's avatar Razvan Pascanu 提交者: Razvan Pascanu

fix for computing Rop wrt to shared variables in a scan

Issue : scan used to compute something, that I thought was the R-op with respect to shared variables with updates of the inner function. After more reflection, I think those numbers I'm computing have no meaning .. Unless the user asks explicitly for the R_op with respect to some value that is a shared variable, this would not affect anything (just some extra computations). The reason I removed them is not only the possible meaningless of these numbers, but also the fact that R_op methods are not defined for random number sampling function, which would appear as shared variable. So you would get that you can not compute the R-op because some function is not defined for that op, even though that is only to compute some values you don't care and which might not have any meaning. I have no idea exactly how to test this, since is not a bug per-se is more of a semanting error in my understanding of what the R-op is suppose to do.
上级 195e8380
......@@ -1540,6 +1540,8 @@ class Scan(PureOp):
rop_self_outputs = self_outputs[:-1]
else:
rop_self_outputs = self_outputs
if self.info['n_shared_outs'] > 0:
rop_self_outputs = rop_self_outputs[:-self.info['n_shared_outs']]
rop_outs = tensor.Rop(rop_self_outputs, self_inputs, inner_eval_points)
if type(rop_outs) not in (list, tuple):
rop_outs = [rop_outs]
......@@ -1559,7 +1561,7 @@ class Scan(PureOp):
info['n_sit_sot'] = self.n_sit_sot * 2
info['n_mit_mot'] = self.n_mit_mot * 2
info['n_nit_sot'] = self.n_nit_sot * 2
info['n_shared_outs'] = self.n_shared_outs * 2
info['n_shared_outs'] = self.n_shared_outs
info['gpu'] = False
info['as_while'] = self.as_while
info['profile'] = self.profile
......@@ -1622,8 +1624,8 @@ class Scan(PureOp):
e = e + self.n_shared_outs
ib = ie
ie = ie + self.n_shared_outs
scan_shared = inputs[b:e] + eval_points[b:e]
inner_shared = self_inputs[ib:ie] + inner_eval_points[ib:ie]
scan_shared = inputs[b:e]
inner_shared = self_inputs[ib:ie]
# NIT_SOT sequences
b = e
......@@ -1652,7 +1654,7 @@ class Scan(PureOp):
inner_out_nit_sot = self_outputs[b:e] + rop_outs[b:e]
b = e
e = e + self.n_shared_outs
inner_out_shared = self_outputs[b:e] + rop_outs[b:e]
inner_out_shared = self_outputs[b:e]
inner_ins = (inner_seqs +
inner_mit_mot +
......@@ -1695,9 +1697,7 @@ class Scan(PureOp):
b = e + self.n_nit_sot
e = e + self.n_nit_sot * 2
final_outs += outputs[b:e]
b = e + self.n_shared_outs
e = e + self.n_shared_outs * 2
final_outs += outputs[b:e]
final_outs += [None]*self.n_shared_outs
return final_outs
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论