def alias_root(v):
 if (v.owner is None):
  return v
 vmap = getattr(v.owner.op, 'view_map', {})
 dmap = getattr(v.owner.op, 'destroy_map', {})
 outpos = v.owner.outputs.index(v)
 v_views = (vmap.get(outpos, []) + dmap.get(outpos, []))
 if (len(v_views) > 1):
  raise NotImplementedError((str(v) + ' is a view/destroyed version of more then one inputs. Currently, we only support the case where an output is a view or a destroyed version of one input.'))
 elif v_views:
  return alias_root(v.owner.inputs[v_views[0]])
 else:
  return v

def alias_root ( v ) : if ( v . owner is None ) : return v vmap = getattr ( v . owner . op , 'view_map' , { } ) dmap = getattr ( v . owner . op , 'destroy_map' , { } ) outpos = v . owner . outputs . index ( v ) v_views = ( vmap . get ( outpos , [ ] ) + dmap . get ( outpos , [ ] ) ) if ( len ( v_views ) > 1 ) : raise NotImplementedError ( ( str ( v ) + ' is a view/destroyed version of more then one inputs. Currently, we only support the case where an output is a view or a destroyed version of one input.' ) ) elif v_views : return alias_root ( v . owner . inputs [ v_views [ 0 ] ] ) else : return v
return the variable to which v is aliased by view_maps and destroy_maps .