def apply_rebroadcast_opt(rval):
 changed = True
 while (changed and rval.owner):
  changed = False
  rval2 = theano.tensor.opt.local_useless_rebroadcast.transform(rval.owner)
  if rval2:
   assert (len(rval2) == 1)
   rval = rval2[0]
   changed = True
  if rval.owner:
   rval2 = theano.tensor.opt.local_rebroadcast_lift.transform(rval.owner)
   if rval2:
    assert (len(rval2) == 1)
    rval = rval2[0]
    changed = True
 return rval

def apply_rebroadcast_opt ( rval ) : changed = True while ( changed and rval . owner ) : changed = False rval2 = theano . tensor . opt . local_useless_rebroadcast . transform ( rval . owner ) if rval2 : assert ( len ( rval2 ) == 1 ) rval = rval2 [ 0 ] changed = True if rval . owner : rval2 = theano . tensor . opt . local_rebroadcast_lift . transform ( rval . owner ) if rval2 : assert ( len ( rval2 ) == 1 ) rval = rval2 [ 0 ] changed = True return rval
apply as many times as required the optimization local_useless_rebroadcast and local_rebroadcast_lift .